According Thomas Laqueur’s 2004 Solitary Sex, masturbation wasn’t a major concern in sexual ethics until fairly recently.
Stephen Greenblatt summarized the argument in a 2004 review in the NYRB: “Medieval Christian theologians . . . did have a clear concept of masturbation as a sin, but it was not, Laqueur claims, a sin in which they had particularly intense interest. With the exception of the fifth-century abbot John Cassian, they were far more concerned with what Laqueur calls the ethics of social sexuality than they were with the ethics of solitary sex. What mattered most were ‘perversions of sexuality as perversions of social life, not as a withdrawal into asocial autarky.’ Within the monastery anxiety focused far more on sodomy than on masturbation, while in the world at large it focused more on incest, bestiality, fornication, and adultery.”
The narrative of Genesis 38 did not loom large their discussions of the sin: “When theologians commented on Genesis 38 at all, it was to condemn Onan not for what he did but for what he refused to do: thus Saint Augustine interpreted Onan as the sort of person who fails to do what he can to help those in need. As befits a religion that rejected the strict rabbinic obligation to procreate and instead celebrated monastic chastity, the argument here has slipped away from the obligation to be fruitful and multiply and changed into a more general moral obligation. Church fathers could not share in particularly intense form the Jewish anxiety about Onan, precisely because the Church most honored those whose piety led them to escape from the whole cycle of sexual intercourse and generation.”
Ascetically inclined moralists viewed masturbation as one of several expressions of sexuality that needed to be overcome. What needed to be killed was sexual passion in all its expressions: “A very severe moralist, Raymond of Peñafort, did warn married men against touching themselves, but only because arousal might make them want to copulate more often with their wives. It may be better to marry than to burn, but that sort of thing should be kept to a minimum. Only one early-fifteenth-century text - a three-page manual ‘On the Confession of Masturbation,’ attributed to the chancellor of the University of Paris, Jean de Gerson - instructed priests on how to elicit confessions of this sin, and this text does not seem to have circulated widely.” Even the Reformation “did not fundamentally alter the traditional conception of masturbation or significantly intensify the level of interest in it.”
It wasn’t until the early eighteenth century that masturbation became classified as a major evil, and in the event it was not because of its sexual nature but because it was treated as a disease. In a 1712 treatise Onania, a writer identified by Laqueur as John Marten “announced that he had providentially met a pious physician who had found remedies for this hitherto incurable disease. The remedies are expensive, but given the seriousness of the condition, they are worth every penny.” This was followed in 1760 by David Tissot’s L’Onanisme, which “became an instant European literary sensation.” After Tissot, doctors claimed that all sorts of medical complications followed from masturbation: “spinal tuberculosis, epilepsy, pimples, madness, general wasting, and an early death.” It was, for Tissot, more dangerous than smallpox.
Why should the liberated Enlightenment worry about a private pleasure like masturbation? Laqueur argues that there were three complaints: Masturbation is private, based on a fantasy, and creates an insatiable addiction. But he thinks something deeper was going on too. The liberation of the Enlightenment was massive and disorienting that the attack on masturbation was, Laqueur claims, the “centerpiece of a program for policing the imagination, desire, and the self that modernity itself had unleashed.”
In the long run, modernity reconciled itself to solitary sex, saw that it was consistent with Enlightenment liberation. Even that small remnant of Enlightened sexual policing has been abandoned.