Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
A wet dream does not break the fast, as it is an involuntary act that happens during sleep. Scholars agree that fasting remains valid in such cases, and no expiation is required. However, ghusl should be performed before prayers.
Answering your question, the Fatwa Center at IslamWeb, states:
Islamic Ruling on Wet Dreams during Fasting
Wet dreams do not affect fasting according to the agreement of scholars. The Kuwaiti Fiqh Encyclopedia states:
Prophetic Guidance on What Does Not Break the Fast
Wet dreams do not affect fasting and do not invalidate it by consensus. The Prophet (peace be upon him) said, “Three things do not break the fast of the fasting person: cupping, vomiting, and the wet dream.”
Why Wet Dreams Do Not Invalidate Fasting
That is because it is hard to abstain from it except by abandoning sleep, whereas sleep is permissible and abandoning it is not possible, and because there was no actual intercourse or ejaculation resulting from lustful sexual contact. It has no effect on Hajj as well by consensus.
This ruling is not affected by the fact that ejaculation only occurred after wakefulness because you did not intend what happened and because if a wet dream occurs during sleep, one cannot control ejaculation after wakefulness.
What to Do after a Wet Dream while Fasting
You were supposed to complete your fasting and not break it and to ask the people of knowledge about the rulings that you do not know in the matter of your religion and acts of worship. It is impermissible that one does something until he knows the ruling of Allah Almighty concerning it.
As long as you did what you did, you should make up for the day – as you did. You should also repent to Allah Almighty from this deed.
The following fatwas provide additional guidance:
- Does Discharging Sexual Fluid Involuntarily Nullify Fasting?
- Will Masturbation Break Your Fast?
Does Unexpected Pre-Seminal Release Break My Fast?
What Are the Rulings of Fasting?
Does Wet Dream Break Itikaf? - Am I Liable to Punishment for Wet Dream?
- What to Do If You Experience Wet Dream during Hajj?
Almighty Allah knows best.