Question: A Muslim man committed Zinaa (fornication) with a woman who was not Muslimah and she became pregnant by him. Then, after she delivered the child for him, she accepted Islaam. So what is the ruling on the child? Is it considered legally his child according to the Sharee'ah?
Answer: The child is not legally his according to the Sharee'ah, because the Prophet (sallallaahu 'alayhi wa 'alaa aalihi wa sallam) said, "The child (from fornication) belongs to the bed (meaning the woman) and the 'Aahir gets the stone." Thus, the child goes to (i.e. belongs to) its mother, and the 'Aahir, which means the fornicator, only gets loss and regret (i.e. the child is not his).
In reference to him marrying her, if he knows that she has repented afterwards, then there is no harm in that. If she has not repented, then Allaah, the Mighty and Majestic, says: "And that is something made forbidden for the believers." [An-Noor (24):3]
Meaning marrying the female fornicator, or marrying a chaste girl to the man who is a fornicator. So if the man knows that she has repented from this act of fornication and she has accepted Islaam, then there is no harm in him marrying her.
Source: Tuhfatul-Mujeeb 'alaa As'ilatil-Haadhir wal-Ghareeb, Question no. 29