It should be clear that whoever has a wet dream whilst he is fasting, this does not affect his fast, but he does have to do ghusl to cleanse himself from janaabah (impurity) if maniy (semen) was emitted.
Elaborating on this, we’d like to furnish you with the following fatwa issued by Sheikh M. S. Al-Munajjid, a prominent Saudi Muslim lecturer and author, who states: “Having a wet dream during the day in Ramadan does not invalidate the fast, because this is a matter that is beyond a person’s control, and he cannot prevent it. Allah says:
“Allah burdens not a person beyond his scope” (Al-Baqarah 2:286) “If a man experiences a wet dream this does not invalidate his fast, because it was involuntary on his part; it is similar to the case when something enters his throat whilst he is sleeping.”
The Standing Committee was asked about a man who had a wet dream during the day in Ramadan – what is the ruling on that? They replied: Whoever has a wet dream whilst he is fasting or is in a state of ihram for Hajj or ‘Umrah, there is no sin on him and he does not have to offer expiation (kafarah). It does not affect his fast, but he does have to do ghusl to cleanse himself from janaabah (impurity) if maniy (semen) was emitted.
Ihtilaam (wet dream) means seeing intercourse in one’s dream. This is one of the things that Allah has created in human nature for men and women alike. Hence it was narrated from Umm Salamah the Mother of the Believers that she said: “Umm Sulaym the wife of Abu Talhah came to the Messenger of Allah (peace and blessings be upon him) and said, ‘O Messenger of Allah, verily Allah is not shy of (telling you) the truth. Is it necessary for a woman to take a bath (ghusl) after she has a wet dream?’ The Messenger of Allah (peace and blessings be upon him) said, ‘Yes, if she notices a discharge.’” (Narrated by al-Bukhaari, al-Ghusl, 373; Muslim, al-Hayd, 471).”