Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, explains in his contribution to the topic:
“Masturbation is generally considered forbidden in Islam since it is deemed to fall under the category of sexual satisfaction outside the framework of marriage.
According to the Qur’an, those who seek fulfillment outside the framework of marriage are deemed transgressors. Referring to this, Allah Almighty says: “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)
While explaining this verse, one often finds the commentators listing masturbation under the list of the forbidden categories of sexual fulfillment.
What we have stated above is the generally accepted view. However, according to some scholars, if a person is so tormented by his intense sexual desire or craving that he fears falling into Zina (fornication), in such a case, masturbation is permitted as the lesser of the two evils. His case may be compared to that of a person who is permitted to eat pork because of fear of death by starvation.
However, having mentioned the above, we must state that one hardly needs to resort to it when we recognize the relatively flexible approach towards marriage that Islam adopts. Unfortunately, against the clear teachings of Islam, marriage has been rendered another difficult process today due to warped customs and conventions and undue expectations. When we approach marriage from the point of view of pristine Islam, we shall find less and less people being forced to exercise the above type of exceptional rulings.”
The above quotation is excerpted with slight modifications from www.Islam.ca