On this important question, the eminent Muslim scholar and renowned Da`iyah,Sheikh `AbdelKhaliqHasan Ash-Shareef, states that a person is not in a necessity to commit this act, as long as there is no fear of committing zina. A Muslim should not think about this act. Instead, he should abstain from what may arouse his sexual appetite such as watching sex movies or pornographic pictures. Such acts, indeed, sap and drain the Iman (Faith) of a believer, kill his soul and destroy his character.
It is recommended for a Muslim to fill up his time with something useful such as reading or learning the Qur’an; things that will make him nearer to Almighty Allah, enrich his knowledge and strengthen his faith and piety. Allah says in the Qur’an(And let those who do not find the means to marry keep chaste until Allah makes them free from want out of His grace.)” (An-Nur 24:23).
Elaborating on this issue of masturbation in his book, The Lawful and the Prohibited in Islam, Sheikh Yusuf Al-Qaradawi stated:
“The majority of Muslim scholars consider masturbation haram (unlawful). Imam Malik bases his judgment on the verse: “Those who guard their sexual organs except with their spouses or those whom their right hands possess, for (with regard to them) they are without blame. But those who crave something beyond that are transgressors.’ (Al-Mu’minoon:5-7)
Imam Malik argued that the masturbator is one of those who ‘crave something beyond that.’
On the other hand, it is reported that Imam Ahmad IbnHanbal regarded semen as an excretion of the body like other excrete, and permitted its expulsion the same way blood letting is permitted. IbnHazm holds the same view. However, the Hanbali jurists permit masturbation only under two conditions: first, the fear of committing fornication or adultery, and second, not having the means to marry.
We are inclined to accept the opinion of Imam Ahmad in a situation in which there is sexual excitation and danger of committing the haram [adultery]. For example, a young man has gone abroad to study or work, thereby encountering many temptations which he fears he will be unable to resist, may resort to this method of relieving sexual tension provided he does not do it excessively or make it a habit. Yet, better than this is the Prophet’s advice to the Muslim youth who is unable to marry, namely, that he seeks help through frequent fasting, for fasting nurtures will-power, teaches control of desires, and strengthens the fear of Allah. The Prophet (peace and blessings be upon him) is reported to have said, ‘O youth, whoever of you is able to marry, let him marry, for it spares one looking at what one should not, or lapsing in adultery. And if he cannot marry, let him observe fasting, for it is a shield against evil.’(Reported by Muslim.)
Thus, we do advise married Muslims to have their wives with them and not to stay alone. However, if the situation does not allow that, then they should make use of the following:
1- Observing fasting, because it bolsters one’s faith, preserves chastity, and protects one from evil thoughts.
2- Observing moderation in eating and drinking in order to avoid stimulation of desire.
3- Keeping away from anything that is sexually stimulating, such as pornographic pictures, erotic films and love songs.
4- Choosing good and righteous friends.
5- Keeping oneself busy in worship and spiritual acts.
6- Interacting with activities of the society in such a way that it keeps one away from thinking about sex.
7- Avoiding gatherings and places that bring men and women physically close to each other.
8- Trying to admire natural things such as flowers and beautiful scenery, which do not stimulate one sexually, instead of admiring girls and women.
If one finds the previous things useful, then it is forbidden to masturbate. However, if one finds that he cannot relieve himself except through masturbation, and he fears he may lapse in adultery if he did not masturbate, then the juristic rule which states that the lesser evil is to be suffered in order to fend off the major one applies to him, as masturbation is deemed to be the lesser of two evils in this case. But, we would like to stress that this may be done only in the case of dire necessity, when all solutions prove to be of no avail.”