First of all, we’d like to state that Ramadan is the month of mercy, forgiveness and seeking protection from the hellfire through various acts of worship. It is a special month in the sense that we are supposed to make the best use of our time to draw closer to Allah the Almighty by doing good deeds and staying away from bad deeds. We should focus on reciting the Qur’an, praying taraweeh, giving charity, making dhikr (mention of Allah) and istighfar (seeking forgiveness for one’s sins), etc. The wise Muslim is he or she who never misses any good in Ramadan. In an authentic Hadith the Prophet (peace and blessings be upon him) is reported to have said: “Truly is lost whoever hears my name and does not invoke blessings on me; truly is lost whoever catches Ramadan and he misses the chance to get his sins forgiven; truly is lost whoever catches his parents in their lives until they become old, and yet he misses to attain Paradise (through honoring and taking care of them.” (At-Tirmidhi, Sunan, Vol. 5, Hadith no. 3613; this Hadith has been classified as hasan saheeh (good and authentic) by Sheikh Al-Albani in his book Saheeh At-Tirmidhi, Hadith no. 2810)
That is why a Muslim should not only avoid the haram during Ramadan, but should not even think of it, as he or she is supposed to be involved in `ibadah (worship) and increasing his or her good deeds.
as far as masturbation is concerned, we are required to avoid it at all times and not only in Ramadan.
With regard to masturbating in the daytime of Ramadan, Sheikh Muhammad Iqbal Nadvi, Imam of Calgary Mosque, Canada, and Former Professor at King Saud Univ., Saudi Arabia, states:
“If someone masturbates while fasting, his or her fasting is broken, and he or she has to make up for that day later on. The reason is that the release of sperm (or sexual vaginal secretions in the case of women) comes as a result of desire and sexual excitement, which is haram during the daytime of Ramadan.
We know that scholars said if someone vomits by intention it will break the fast but if he vomits unintentionally, it will not break the fast. If we apply the rule of qiyas (analogy) to this case, we would say that if someone releases sperm (or sexual vaginal secretions in the case of women) due to a sexual (wet) dream or without desire, it will not break the fast. However, if he or she intentionally masturbates and releases the sperm (or sexual vaginal secretions in the case of women), so of course it comes with a desire and it has the same `illah (cause) in the qiyas process. That is why it breaks the fast.”
Given the above, it becomes clear that if you masturbated in the daytime of Ramadan, you should know that you have committed two sins: one for committing masturbation and the second for breaking the fast. You should first ask Allah for forgiveness and resolve not to do that again whether in Ramadan or after Ramadan. Also, after Ramadan you can make up for that day by fasting another day in expiation for the day you have broken.