All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
If this woman was married when she was raped, then the child will be traced back to her husband and he is considered his child as he was born on his bed. We have already clarified this in fatwa 132410.
What you mentioned, that he might resemble the person who raped her, is not taken into account. An-Nawawi said in interpreting the hadeeth by Muslim, “The child is traced back to the owner of the bed means that if a man has a wife or a woman whom he possessed by his right hand and she gave birth to a child in a period during which it could be his child [i.e. 6 months or over], then the child is traced back to him and becomes his child and they inherit from each other and other rulings of birth take effect regardless of whether or not he resembles him.”
So his parents should take care of him and nurture him in a good manner. The mother should strive to forget this incident and seek the help of Allaah and remember Him often; Allaah says (what means): {Those who have believed and whose hearts are assured by the remembrance of Allaah. Unquestionably, by the remembrance of Allaah hearts are assured.} [Quran 13:28]
If this wife considers that she needs a trustworthy psychiatrist, then she may go to him and consult him as he may help her overcome this shock.
As regards what was mentioned regarding the injustice of the Lord, the Almighty, then if the matter was just a thought that came across one’s mind and the person repelled it, then it does not affect his faith. Abu Hurayrah narrated, “Some Companions of the Prophet came to him and asked him, 'We find in ourselves what one of us considers too grave and serious to talk about.' The Prophet said, 'Do you really find that?' They replied, 'Yes.' The Prophet then said, 'That is explicit faith.'” [Muslim]
It means that repelling those thoughts is the fruit of pure faith. But if the heart was reassured with this belief and it [this belief] settled in one’s mind, or it led to words or actions, then it is apostasy from Islam and one's marriage contract becomes void, but if he/she repents, then their marriage is ongoing (continues). This ruling applies regardless of whether it was the husband or the wife who had those thoughts.
Allaah knows best.