If a man does not know how the sperm got on his clothes, and he has already prayed, should he perform ghusl and repeat all of his prayers since the last time he slept? If he thinks that it happened before his most recent sleep, he should repeat all of his prayers since the supposed time of his ejaculation .
This refers to the penis and the vagina. If one's penis has entered his wife's vagina, ghusl is obligatory even if there was no ejaculation. Says Allah, "If you are sexually impure, purify yourselves." Commenting on the subject, ash-Shaifi says, "In the Arabic language, sexual impurity refers to any type of sexual intercourse, regardless of whether sperm was ejaculated or not. If someone says, 'So and so is sexually impure due to so and so,' it refers to any type of sexual intercourse between them, even if there was no ejaculation. No one disagrees that the fornication which requires the prescribed punishment is sexual intercourse, even if there is no ejaculation."
Abu Hurairah reported that the Prophet, upon whom be peace, said, "When anyone sits between the four parts of her body and exerts himself (has intercourse), bathing becomes obligatory (for both)." (Related by Ahmad and Muslim.)
Sa'eed ibn al-Musayyab reported that Abu Musa al-Ash'ari said to 'Aishah, "I would like to ask you something, but I am embarrassed." She said, "Ask and don't be shy, for I am your mother." He asked about a man who had intercourse but did not ejaculate. She said, on the authority of the Prophet, "If the two circumcised parts encountered each other, ghusl is obligatory." This hadith is related by Ahmad and Malik with different wordings. There is no doubt that there must be insertion; if there is only touching, ghusl is not obligatory for either. All scholars agree on this point.
Concerning menstruation and childbirth bleeding, Allah says in the Qur'an, "Do not approach them until they become pure. When they are pure, go to them in the manner that Allah has prescribed for you." The Messenger of Allah, upon whom be peace, said to Fatimah bint Abu Habish, "Do not pray during your period. After it has ended, perform ghusl and pray." (Related by al-Bukhari and Muslim.)
Post-childbirth bleeding is treated in a similar manner, according to the consensus of the companions. If a woman gives birth and has no flow of blood afterwards, some scholars say that she must perform ghusl, while others say that it would not be necessary. There is no textual authority on this latter point.