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, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Abu Daawood reported in his Sunan that Sa‘eed ibn Al-Musayyib narrated that a man from Al-Ansaar said: "I married a virgin woman in her veil. When I entered upon her, I found out that she was pregnant. So the Prophet, sallallaahu ‘alayhi wa sallam, said: "She is entitled to the dower by which having intercourse with her was made lawful to you, and the child is your slave. When she has delivered, flog her," (according to the version of Al-Hasan). The version of Ibn Abi As-Sariyy reads, "You people, flog her," or he said, "You people inflict the Hadd (prescribed punishment) on her."
Shaykh Al-Albaani classified this Hadeeth as weak. He wrote, “The chain of narration of this Hadeeth is weak due to the 'An'anah (i.e. instead of saying “he narrated to me”, it is said “from him” which creates the possibility of an unknown narrator in between) of Ibn Jurayj. Al-Bayhaqi asserted that he (Ibn Jurayj) transmitted it on the authority of Ibraaheem ibn Abi Yahya who reported it on the authority of Safwaan, but he (Ibn Jurayj) reported it on the authority of Safwaan by the way of Tadlees (i.e. a narrator reporting from his Shaykh whom he met, what he did not hear from him in such a way as to create the impression that he heard the Hadeeth in person. A Mudallis [one who practices Tadlees] usually uses the mode "on the authority of" or "he said" to conceal the truth about the chain of narration) as he (Ibraaheem ibn Abi Yahya) is Matrook (i.e., his Hadeeth is not accepted). Abu Haatim Ar-Raazi commented on this Hadeeth earlier, “It is a Mursal (i.e. a Hadeeth narrated by a Tabi'i [successor of the Prophet's Companions]) with an unconnected chain of narration.” The compiler (Abu Daawood) cited it on the authority of some narration through Sa‘eed ibn Al-Musayyib as a Mursal report." (Dha'eef Sunan Ibi Daawood)
Even if we assume that the chain of narration of this Hadeeth is Saheeh (sound) or Hasan (good), it does not indicate that this woman’s child should be a slave to the husband. Scholars refuted this assumption that may be understood from the Hadeeth. Ibn Al-Qayyim compiled these refutations in his book Zaad Al-Ma‘aad as follows: “As for the verdict issued by the Prophet, sallallaahu ‘alayhi wa sallam, to consider this woman’s illegitimate child a slave to her husband; there are three reported opinions:
1) It is said that because this child is illegitimate and has no father and the woman deceived the husband and consequently she became entitled to the whole dower, the Prophet, sallallaahu ‘alayhi wa sallam, issued his verdict that the illegitimate child should be considered a servant to the husband. He is not to be considered a slave, given that his mother is a free woman and so is he. This is one possibility.
2) It could also be a kind of punishment for the mother as she committed Zina (fornication) and deceived the husband into marrying her (while being pregnant). In this case, the verdict of the Prophet, sallallaahu ‘alayhi wa sallam, is for this particular case; it should not be applied to other cases (or other people).
3) It may be an abrogated ruling; it's said that in the early days of Islam the indebted person was to become the slave of the creditor, if unable to pay off the debt.” [End of quote]
Al-Khattaabi said, “I do not know of any scholar suggesting that the illegitimate child is not free; if he is born to a free woman then how could he be enslaved? The words of the Prophet, sallallaahu ‘alayhi wa sallam, may mean that if it had been proven that the child is illegitimate (and born out of wedlock), the husband was advised by the Prophet, sallallaahu ‘alayhi wa sallam, to take care of the child and raise him to be at his service. Hence when the child grows up, he would be as obedient to this husband as the slave is to his master as a reward for his generosity and kindness. An Arabic proverb reads, ‘By means of kindness, a free man is enslaved!’.”
Allaah Knows best.