I have a friend who is married and his wife is in another country he goes there whenever he can. He has asked me regarding masturbation and I have told him is a sin and is considered Haraam in majority of scholars but I told him if one fears for committing adultery then is masturbation is better than adultery. And this I think its from Imam Hanbal but I am not sure. Now the problem is he is Shaafi'ee and Shaafi'ee says is Haraam to do that. He cannot get married to another woman due to some reason which make is unable to get married and also he does not want to commit Haraam but doing adultery and as in this Western countries is really hard for a young guy to stop himself with all the Fitnah going on. I have told him to fast but he said he can't due to some problems he has. So it allowed for him to masturbate if his wife is in another country and also not able to marry. If he does masturbate fearing to commit Zina is that considered a sin, please he is also a young man of the age of about 24-25.
Lastly, I would like to thank you for your help for the help your providing to the Muslim world.
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
There is no doubt that residing in a non-Muslim country is a serious danger for the Muslim's religion, that's why the Prophet forbade Muslims from residing in a non-Muslim country. Therefore, your friend should be advised not to reside in that country, if there is no necessity or dire need for him to reside there, and to return to his country if it is a Muslim country. Anyway, he has to endeavour to reside with his wife in order to protect himself from committing adultery. However, if he is afflicted by residing in that country where he has no wife, we advise him to fear Allaah, lower his gaze and avoid going out to public places unless there is a need for it. He has also to cure what incites his desires by every permissible means, like fasting and practising sports and the like.
As regards masturbation, it is forbidden in principle, so he should not resort to masturbation. However, if he is obliged to repel his ardent desires and fears to commit adultery, then there is no doubt that masturbating is of a lesser degree of sinfulness than committing adultery. Yet, he is still sinful as this matter is not permissible Islamicly, but he did so to commit the lesser of two evils, and therefore he has to repent.
Allaah knows best.
You can search for fatwa through many choices