Once, 'Ammar ibn Musa asked Imam Sadiq [a] about commiting sexual intercourse with beasts or masterbation by the hand or other limbs of one's ownself, and he [a] replied: "Any form of these kinds and the like of them by which man pours forth his water, is (considered as) fornication (and it is unlawful)."
AI-Kafi, vol. 5, p. 541
Question: What is the situation of Islam towards masturbation? Some youths say that doctors think it has no harm.
The answer: Not all that doctors say is true. There are other doctors that say the opposite. What is important to us is what our Wise Creator says. He is more aware of His creatures. Islam, which is the speech of Allah, is clear in its verdicts. The Prophet (S) and his progeny have prohibited it.
Masturbation is a filthy doing. Some traditions have called it as “adultery with oneself”. It does not fit the dignity of a respectable man. The clearest evidence on its ugliness is that the doer feels disgust with himself after finishing this act.
Islam does not prohibit a thing unless it has a great harm. In this concern, masturbation weakens the sexual ability at the time when it is needed in marriage. This weakness appears in the sudden ejaculation or that the penis does not stand erect during making love, and this mortifies sexual pleasure and kills marital happiness, which, consequently excites the nerves of the wife and the husband and then their lives enter into the tunnel of problems and troubles.
Doctors think that one of the causes for itching in the genitals and the area around them is masturbation. This makes one who practices masturbation rub his genitals even before others. Among the harms of this bad habit are leanness, headache, sudden exhaustion, and fatigue.
These harms cause a dangerous psychological state that leads one to worry, melancholy, loneliness, and complexes, which are the factors of final failure.
Incidentally, I remember that in 1984 in India, Bombay, a young man from the Arab Gulf countries committed suicide by throwing himself from the window of a hotel, and the reason, as it was said, was that he became angry at his sexual failure (and that his sword could not stretch in his bitter sexual fighting) with an Indian prostitute. He took a knife, cut his genitals, and threw himself into Hell and the evil destination!
I do not think that colonialists, the producers of sex films, and the doctors, who are bound by these circles, want something for the youth besides this failure and collapse!
Dear young man, do you understand now why Islam has prohibited this bad habit?
The Prophet (S) has said, ‘He who makes love with his hand is cursed.’
Imam as-Sadiq (a.s.) has said, ‘There are three persons, whom Allah will not talk to, look at, or purify and who will get painful torment on the Day of Resurrection; one who plucks out his white hairs (shaves his beard), one who makes love with himself (practices masturbation), and one who is sodomized on.’
We must mention here that the prohibition of masturbation does not concern males only, but females also are not permitted to practice it.
How great the situation of Imam Ali (a.s.) was towards someone who had been accused of practicing masturbation! Imam Ali (a.s.) would beat him on his hand until it turned red and them he would make him marry by giving him money from the treasury.
Dear brother, I feel that you wish you were in an Islamic state which was ruled by someone like Imam Ali (a.s.) who would marry you from the revenue of the treasury that was specified for the welfare of the Muslims!
I say: take me with you in your wishes! Ali and his Islamic state remain as two orphaned examples on the page of history!
 Mustadrak al-Wassa’il, vol.2 p.570
 Al-Hikam adh-Dhahira, p.30.
 Wassa’il ash-Shia, vol.18 p.574, vol.14 p.267.