Question 141: If you masturbate during the night and forget to do ghusl, can you still perform ghusl when you wake up and fast that day?
Answer 141: The grand maraja’ answer in this regards is as follows: If one who becomes jonob during a night of the holy month of Ramadan and is sure or probably knows that if he goes to sleep he will wake up before morning Adhan (call to prayer) and do ghusl. So, if he falls asleep with the decision till Adhan, his fast would be considered as valid.
If one goes to sleep and wakes up later and knows or guesses that if he wants to go to sleep again he’ll wake up before morning adhan with the decision to do jinabat ghusl but he won’t wake up till adhan, then one must make his fast up.
There is no need to give Kaffarah even if he wakes up of the second sleep and goes to sleep for the third time and won’t wake up till adhan.
Note: Masturbation is defined as self-stimulation of the sexual organ till one achieves emission of semen or orgasm. This applies to both men and women. This Self-satisfaction which is referred to as Istimna’ (masturbation) is a major sin and haram. It has a heavy punishment. If one has committed such forbidden act repentance and seeking God’s forgiveness would be sufficient for forgiveness.
It should be noted that masturbation is one of the forbidden act which a person keeping fast must abstain. Ejaculation of the Semen, whether by masturbation, touching, kissing, rubbing (the male organ) on the thighs (of another person), or such other acts which are intended to cause discharge of semen. Rather even in case when the discharge of semen is not intended, but it was the usual consequence of the said act, in that case too it shall render the fast void. Of course, if ejaculation takes place without doing something which causes ejaculation in a person as a matter of his habit even without any intention on his part, it shall not render the fast void.
For further information in this regards, please read the following answers:
Index: Rules concerning Janabat during night or day time in the month of Ramadan, answer 394.
Index: Things from which a person keeping fast must abstain & Kaffarah (Expiation), answer 372.
Index: Number of things which are disapproved (Makruh) for a person observing fast, answer 566.
Index: Rules of prayers and fasting performed without ghusl, answer 034.
Index: Impermissibility of making Wudu after Ghusl, answer 035.
 . Tawzih al-masa’il (al-mohasha), vol 1, p 912, question 1627 . Ibid, p 914, question 1630.
 . Tahrir al-Wasilah of Imam Khomeini (ra), Vol. 1, Chapter on Things Which Must Be Refrained in a Fast.