Praise be to Allah
If the shar‘i ruling was worked out on the basis of medical information only, and the medical findings changed, then in that case the shar‘i ruling would also change according to new medical findings. That is like the change in the ruling on smoking – over the years – for example. Because medical knowledge when tobacco first appeared and was used for smoking did not indicate that there was any real physical harm from tobacco, the fatwas of many scholars at that time said that it was permissible to deal with tobacco, consume it and buy and sell it. But when medical science advanced and new medical research proved the grievous harm that smoking causes to the human body, the shar‘i ruling changed and it was prohibited. The fatwas of most contemporary scholars state that it is prohibited, because the ruling on smoking is based on medical findings and the harms and benefits that tobacco may cause. It is not something based on specific religious texts.
The agreed-upon fiqhi principle states that the ruling is connected to the reason for it, and the ruling applies when the reason for it is present, and does not apply when the reason is absent. See Tahqeeq al-Burhaan fi Sha’n ad-Dukhaan by Mar‘i al-Karami (d. 1033 AH), annotated by Mashhoor Hasan Salmaan.
This in fact is not a change to the shar‘i ruling; rather it is a change in the view of the scholars that is based on the findings on smoking and the harm it causes.
As for masturbation, or the “secret habit”, the reason for its prohibition as mentioned by the scholars is not physical harm only. Rather it is aimed at preventing physical desires from dominating a person’s thinking, and not allowing any way of fulfilling those desires except through halaal marriage. We may note this idea in the verse in which 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”
The shar‘i reason for not allowing it is based on the apparent meaning of this verse, which the scholars may understand in various ways and reach a number of conclusions:
It is aimed at barring the means of fulfilling these overwhelming desires that may go beyond the secret habit to looking for haram means such as watching movies, engaging in unlawful relationships and looking at images.
It is aimed at protecting man’s power of reasoning and physical energy from being wasted in an inappropriate manner. Or it may be prohibited on the grounds that it is contrary to dignity, and so as to protect the individual from doing base and ignoble actions which serve no purpose, therefore it could be prohibited on moral grounds, as Imam Ahmad ibn Hazm said: We disapprove of it, because it is contrary to noble characteristics and virtuous deeds. End quote from al-Muhalla (12/407).
Medicine is also one of the reasons that could be understood from the verse. That is because doctors have affirmed the harm of this practice and its addictive nature that could lead to ruining one’s health. So medicine is not the only reason for this shar‘i ruling, such that it might be said that the ruling should change with changes in medical findings.
We searched the books of the fuqaha’ and we did not find anyone who limited the reasons for the prohibition on masturbation to medical findings on its harm. Rather we found in the words of ash-Shawkaani that which indicates that medical knowledge is just one of the reasons for the prohibition; it is not the only reason. That is when he (may Allah have mercy on him) said: Among the reasons they cited is the fact that masturbation is harmful, as was mentioned by physicians. End quote from al-Fath ar-Rabbaani (7/3380).
We say all of this on the assumption that what is mentioned of health benefits of the secret habit is actually correct. But proving that requires proper scientific studies or the support of specialists whose views are based on definitive academic research, not just quoting some statements (of unknown people) from here and there, because such quotations do not constitute knowledge or a sound view.
We refer you to what has been written on some medical websites that are supervised by specialists, for you will find some beneficial information there, in sha Allah:
And Allah knows best.