Question: What is the ruling regarding masturbation?
Response: Onanism is masturbation with the hand – which is prohibited; It is obligatory upon all Muslims to take precaution against it, because doing it is contrary to the statement of Allaah (‘Azza wa Jall):
{And those who guard their chastity (i.e. private parts, from illegal sexual acts). Except from their wives or (the slaves) that their right hands possess, – for then, they are free from blame; But whoever seeks beyond that, then those are the transgressors}, [Soorah al-Mu.minoon, Aayahs 5-7]
In addition to that which exists in masturbation of much [health-related] harm.
And Allaah is the Expounder of All Success.
Shaykh Ibn ‘Uthaymeen
I’laam al-Mu’aasireen bi-Fataawa Ibn ‘Uthaymeen – Page 184 fatwaonline.com