Repentance From Fornication and Status of Child
Question

                There is another problem that has been worrying me for some time—namely, I committed fornication with a woman. How do I repent? Can I marry her in order to cover up the whole affair?

Another man says he committed fornication outside his country, and he knows that the woman conceived and delivered a child. Is this his child? And is it obligatory for him to bear the costs of the child’s upbringing?
Praise be to Allah.
    Questions of this sort are 
    asked so often and by so many that it is time Muslims paid serious attention 
    to their reformation in the light of the Quran and Sunnah (prophetic 
    teachings), in order that such things do not occur in the first place. 
    Special stress is to be placed on the lowering of the gaze, no bodily 
    contact (including shaking hands) between men and women, wearing of the full 
    hijab (women’s Islamic dress code), prohibition of meetings in secrecy in 
    particular and of mixing of sexes in general, discouraging unwarranted 
    travel to non-Muslim countries, and early marriages. As for the question 
    about one who committed fornication, there can be two situations.

    Either the man did it by force, 
    that is, raped the woman. Such a man should pay her the amount of mahr 
    (dower) in accordance with her social class, as compensation for what harm 
    he caused her. As for himself, he should sincerely repent. And, if the 
    matter has reached the authorities, then he should be punished according to 
    the law of shari’ah (Islamic law). See Madarij. Or, he has had sex with a 
    woman who consented to the act. There is nothing due from such a man except 
    repentance. Neither the child is his, nor is the cost of upbringing born by 
    him because it is an illegal child and must be attached to the mother and 
    not the father. 

    The man’s marriage to the 
    woman, for the sake of covering up the issue, is also not permissible. For 
    Allah revealed in the Quran a verse whose meaning can be translated as: “An 
    adulterer does not marry but an adulteress or mushrika (female polytheist). 
    And an adulteress does not marry but an adulterer or mushrik (male 
    polytheist).” (24:3)

    It is also not permissible to 
    marry a woman who is pregnant from an adulterous act, even if the man has 
    fathered the baby in the womb, as it is also not permissible to marry a 
    woman about whom it is not known if she is pregnant or not.

    Nonetheless, if he repents, and 
    she also repents, and she is not carrying a child, then it is permissible 
    for him to marry her and begin a new life. If she is carrying a child, they 
    must wait until she gives birth.

    And Allah knows best.