All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The relationship between that man and that woman is one of the two following cases:
1- This relationship is acknowledged in the customs of their society as a marriage; then, in this case, that child is the son of that man; he must spend on him and take care of him, and they both inherit from each other. Shaykh Ibn Taymiyyah said:
“The Muslims have agreed that if a Muslim consummates a marriage (has sexual intercourse) with his wife in a marriage which he believes to be valid, then his child from that marriage bears his name and they inherit from each other, according to the consensus of the Muslims, even though this marriage is invalid also according to the consensus of the Muslims … the confirmation of family lineage does not require the validity of marriage; rather, the child belongs to the owner of the bed, as the Prophet said, ‘The child belongs to the owner of the bed, and the stone is for the adulterer.’ [Al-Bukhaari and Muslim].”
2- This relationship is a mere love affair (boyfriend-girlfriend); then the child is not attributed to that man and he has nothing to do with him at all and does not have to spend on him. The child is attributed to his mother because he is illegitimate. For more benefit, please refer to fatwas 172385 and 89082.
In principle, a Muslim should refer to Shariah courts, but if he is forced to resort to man-made laws, then there is no harm on him. Necessities render the prohibitions permissible, but he is not obliged to comply with their provisions except in what conforms to the Shariah, whether in regard to what is related to the spending or otherwise. If he is sentenced to something that he is not Islamically obliged to do, then he can defend himself or appoint someone else to defend him and make every effort in order to get rid of the unjust ruling, and if he does not find a way to get rid of it, then he should fear Allah and be patient, and Allah may make a way out for him.
We recommend that his Muslim brothers help him, stand beside him, and support him. Anas narrated that the Prophet said, “Support your brother whether he is the oppressor or the oppressed.” They said, “O Prophet of Allah, it is all right to support him if he is oppressed, but how should we support him if he is an oppressor?” Thereupon, the Prophet said, “By preventing him from oppressing others.” [Al-Bukhaari]
Allah knows best.