It is narrated from Ismail that Hasan (may Allah have mercy on him) said: (If) a man commits adultery with a woman and then marries her, Hasan (may Allah have mercy on him) said: There is no harm in marrying her except if she is pregnant (i.e., marriage should not be done while she is pregnant), but the child will not be attributed to him. (That is, the child born of adultery will neither be attributed to the father nor will he be an heir.)