Initially, Islam encourages us to have strict control on our sexual organs except for things that Allah made permissible. Allah 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’mun 23: 5-7)
On masturbation, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, issues the following: “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 fulfilment 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.”