Praise be to Allah.
The view that masturbation is haraam is the view of most of the scholars and is supported by shar‘i evidence; in fact all sexual gratification is limited in our sharee‘ah to the wife or concubine (and the latter is not available in our time). Any other means of pleasure used by people is only a means of immorality and spreading mischief in the land, let alone the fact that it is contrary to the fitrah (sound human nature) with which man has been created with regard to the way of fulfilling physical desires. Whatever the case, we find it strange that masturbation is regarded as a means of treating premature ejaculation. What we have read and learned from dozens of medical websites and suggestions for treatment is that masturbation is one of the causes of premature ejaculation; this is according to the testimony of doctors first of all, and also that of those who are suffering from this problem. Hence we do not advise this method of treatment.
But if what you are doing, which requires rubbing the penis, whether maniy (semen) comes out of it or not, if this is a medical treatment that you need, then you can use this method of treatment in a manner that is permissible according to sharee‘ah, by means of intimacy with your wife and masturbation by her hand. The fuqaha’ have stated that masturbation with the wife’s hand is permissible for the husband, because the husband may enjoy all parts of her body – with the exception of anal intercourse – so there is nothing wrong with masturbation with the wife’s hand.
Al-Hattaab al-Maaliki (may Allah have mercy on him) said:
Study of the madhhab and the hadeeths indicate that that – i.e., masturbation with the wife’s hand – is permissible. And Allah knows best.
End quote from Mawaahib al-Jaleel, 3/406
Al-‘Allaamah Zakariya al-Ansaari al-Shaafa‘i (may Allah have mercy on him) said:
Masturbation with the wife’s hand is permissible for him as he may enjoy all parts of her body, but with his own hand (it is not permissible) because Allah says (interpretation of the meaning):
“And those who guard their chastity (i.e. private parts, from illegal sexual acts).
Except from their wives or (slaves) that their right hands possess, - for then, they are free from blame;
But whoever seeks beyond that, then those are the transgressors”
This is among that which is beyond that.
End quote from Asna al-Mataalib, 3/186
Abu’l-Naja al-Hajaawi al-Hanbali (may Allah have mercy on him) says:
He may engage in masturbation with the wife’s hand.
End quote from al-Iqnaa‘; see commentary thereon, Kashshaaf al-Qinaa‘, 5/188
And Allah knows best.