There is a woman who got pregnant from a man, then she gave birth and when the bleeding stopped she married this person, before the end of forty days. Is their marriage contract valid or not?.
What this woman has to do is repent to Allaah from what she has done, because zina is a grave sin, a serious crime and a great evil. The one who commits zina is warned of a severe punishment in this world and in the Hereafter, but the one who repents and mends his ways, Allaah will accept his repentance and turn his bad deeds into good deeds, as Allaah says (interpretation of the meaning):
“And those who invoke not any other ilaah (god) along with Allaah, nor kill such person as Allaah has forbidden, except for just cause, nor commit illegal sexual intercourse __ and whoever does this shall receive the punishment.
69. The torment will be doubled to him on the Day of Resurrection, and he will abide therein in disgrace;
70. Except those who repent and believe (in Islamic Monotheism), and do righteous deeds; for those, Allaah will change their sins into good deeds, and Allaah is Oft‑Forgiving, Most Merciful”
“And verily, I am indeed forgiving to him who repents, believes (in My Oneness, and associates none in worship with Me) and does righteous good deeds, and then remains constant in doing them (till his death)”
She must also conceal herself with the concealment of Allaah and not tell anyone about that. The Prophet (peace and blessings of Allaah be upon him) said: “Avoid these filthy things that Allaah has forbidden. Whoever has done any of them, let him conceal himself with the concealment of Allaah.”
Narrated by al-Bayhaqi and classed as saheeh by al-Albaani in Saheeh al-Jaami’ (149).
It is not permissible for the zaani to marry the zaaniyah until after they have repented, because Allaah says (interpretation of the meaning):
“The adulterer — fornicator marries not but an adulteress — fornicatress or a Mushrikah; and the adulteress –fornicatress, none marries her except an adulterer — fornicater or a Mushrik [and that means that the man who agrees to marry (have a sexual relation with) a Mushrikah (female polytheist, pagan or idolatress) or a prostitute, then surely, he is either an adulterer — fornicator, or a Mushrik (polytheist, pagan or idolater). And the woman who agrees to marry (have a sexual relation with) a Mushrik (polytheist, pagan or idolater) or an adulterer — fornicator, then she is either a prostitute or a Mushrikah (female polytheist, pagan, or idolatress)]. Such a thing is forbidden to the believers (of Islamic Monotheism)”
If they had repented to Allaah before getting married, then their marriage is valid. But if they did the marriage contract before repenting, then the marriage is not valid. This has been discussed in the answer to question no. 85335.
With regard to the marriage contract being done after the bleeding stopped but before forty days had passed, this does not affect the validity of the contract, because what she should do – according to many scholars – is wait until her ‘iddah following zina ends, then do the marriage if she wishes, even if that is within the nifaas period. Her ‘iddah ended when she gave birth.
The Standing Committee for Issuing Fatwas was asked: If a man commits zina with a woman then they get married, and after four months he repents to Allaah, is the marriage valid?
They replied: It is not permissible to marry a zaaniyah and the marriage contract with her is not valid until she repents and her ‘iddah ends.
End quote from Fataawa al-Lajnah al-Daa’imah (18/383).
To sum up: If they had repented from zina before doing the contract, then the marriage is valid. If they had not repented, then the marriage is not valid and they have to repeat the marriage contract after repenting. We ask Allaah to accept their repentance.
And Allaah knows best.