Question: We have heard alot about the one who masturbates, so is there a hadeeth with the meaning that the one who masturbates and the one who has intercourse with a slavewoman is cursed whatever the situation? I implore you to give this subject it’s right, and may Allaah cause you to be of benefit.
Response: I do not recall any hadeeth regarding the masturbator being cursed, however, I have read that a youth was sitting in the gathering of Ibn ‘Abbaas (radhi-yAllaahu ‘anhumaa) and waited until everyone had left, whereupon he asked Ibn ‘Abbaas about that. So Ibn ‘Abbaas said: ((Oh! Oh! Having intercourse with the slavewoman is better than that, and that is better than committing zinaa)), [Transmitted by al-Bayhaqee and Ibn Hazam in al-Muhallaa].
And I have also read in some of the books of the Hanaabilah the permissibility of masturbating for he who fears falling into zinaa. However, (the) gravity (of masturbating) is regarded the same as eating from the (already) dead carcass (i.e. if you have no other food and fear you will die if you do not eat from it), so it is not permissible for him to do so except for that which alleviates the dire necessity. And Allaah is the Most knowledgeable.
Shaykh Mahmood Khaleel Harraas
Fataawa Shaykh Mahmood Khaleel Harraas – Page 282-283. fatwaonline.com