Wa alaykum salam wa rahmatuLlahi wa barakatuHu,
The official position of the Shafi’i Madhhab is that a girl born out of wedlock is not a daughter, marriage to her is permissible but disliked. (Minhaj al-Talibin w/ Tuhfah 2/299) To claim that Imam Shafi’i said it is permissible for one to marry his ‘daughter’ is a misrepresentation of his opinion. Other scholars who wrote on this issue treated Imam Shafi’i and his opinion with a more mature and academic approach than what circulates in some contemporary discourses on this topic. For example, in Sharh Mukhtasar al-Rawd 3/434, al-Tufi mentioned this as an example of qiyas al-shabah. He pointed out that from the biological angle, she is a daughter. But from where the Sacred Law stands, she is not: she does not inherit nor does he inherit from her, he is punished for accusing her of being unchaste, his hand is cut off if he steals from her, and he is executed if he takes her life. Tufi says that “we” i.e. the Hanabilah considered the biological factor when ruling on marriage with her, considering it unlawful. And Imam Shafi’i considered that in all other cases the Sacred Law negates paternalistic rights, and therefore she is likewise in this case not his ‘daughter’ according to the Law. In his Muhalla 8/334, Ibn Hazm mentioned that there is no difference of opinion amongst the scholars on the suspension of these rights, except for when it comes to tahrim.
With that, the As-hab al-Awjuh differed on how they understood Imam Shafi’i on this particular point. Some of them considered that a girl born out of wedlock was ruled lawful as there is no marital bed she may be ascribed to, and it is dubious as to who her father really is. This position is alluded to in the commentaries on Minhaj. In al-Hawi al-Kabir 11/393, Mawardi related from Abu Is-haq al-Marwazi that it is permissible as her being from him is only a mere possibility. However, if that would be a defiantly confirmed fact, then his marrying her would be unlawful. Marwazi gives the example of a man and woman being imprisoned together from the time of their relations until the child is born. He says if a child came from such a situation, then it would be unlawful.
After this citation, Mawardi cited another understanding from Abu Is-haq al-Marwazi’s student, Qadi Abu Hamid. According to him, Imam Shafi’i ruled it was disliked because of the differences of opinion on the matter [khurujan min al-khilaf]. But otherwise, she is not his daughter and therefore she is not unlawful for him. The reasons Mawardi cited for this ruling, those supporting Imam Shafi’s application of qiyas al-shabah, are the same as what was cited above. Tarjih in the Madhhab, at the hands of Shaykhayn and Shaykh al-Islam’s students, went with Qadi Abu Hamid on this particular issue.
And Allah knows best.
Answered by Shaykh Yaqub Abdurrahman