It turns out monks were masturbating a lot and obsessing about it.
Such texts as we have about masturbation up through about 1200 are entirely from ecclesiastic sources, shockingly. Who else had time and ability to think and write about such things? Well, monks in monasteries contemplating life, and the sinfulness of it, principally from the British Isles and Ireland. What they produced in the centuries before ~1000 CE were penitentials - guides for identifying and confessing sin, and these predictably were moral works - these were not 'laws'.
What on earth was going on over on the islands that lead to the production of so many tracts about sins and confession? Because there were a lot of penitentials produced. Among other sins, they obsess over (male) sexual habits from masturbation to simulated sex to anal sex to nocturnal emissions. There were some references to female masturbation, which, according to James Brundage ranked as slightly less sinful than male masturbation. Although there was reference to dildos and sexual devices being proscribed for both women and men.
The penitentials were hugely influential within the Latin Church from the high middle ages, defining many things we associate with Catholic morality. Values, moral-Biblical logic, and obsessions were absorbed from these penitentials (among others influences), concerns which were not an apparent problem requiring much ink of the church fathers of antiquity. The penitentials enter Church 'policy' in the 11th century through the first assemblages of canonical documents - a quasi-Canon law - through collections like Regino of Prüm's De synodalibus causis et disciplinis ecclesiasticis and Burchard of Worms' massive Decretum ('the Corrector'). These 10-11^th century early collections themselves become the basis for the wholesale formalization, indexing and clarification of the Law of the Church, Canon Law, in the 12th century.
That said, masturbation up through the high middle ages was still principally a question of morals and confession, not legal action. Few decretists (the writers and interpreters of Canon Law in the 12-13th centuries) paid much attention to it:
The decretists had little to say about other sexual habits. Only Huguccio and Sicard of Cremona dealt explicitly with masturbation and their discussions focused mainly on defining the degrees of moral guilt in self-stimulation. For Huguccio particularly the two operative criteria were the pleasure that resulted from the sexual experience and the intention of the individual. If the pleasure was slight and not deliberately sought, as for example in nocturnal emission, the degree of guilt was correspondingly slight. But if orgasm was deliberately induced and enjoyed, the degree of guilt and the attached punishment correspondingly increased.^1
So, we don't have a lot of writing on this up to this point beyond the cleric's self-flagellations (ahem), but what we do have is sometimes collapsed under the term 'sodomy', a word some used to described pretty much any deviant act. It's one reason why we, at times, have problems really piecing out the gender/sex issues for this period. Moreover, the writings that have come down to us are focused on celibacy in the priesthood in any form, reflecting the age of Gregorian reforms.
The above summary serves as insight into how pivotal the 10-13th centuries were for the transformation of the western medieval society. The key word above being 'deviance'. If I were to summarize how society 'changed' in this period, I would talk about how the obsession with 'purity' became the hallmark of so much in medieval culture, politics, religion. The obsession with the classification of deviancy was part of that.
The nobility became obsessed with their own lineages, marriages and bloodlines. The Church sought out its own territory of purity across all areas of social life, and society with it: we see the rise of persecution of 'heresy', of Jews, of lepers. Canon Law stipulates what is right from what is wrong and basically invents our modern court systems for determining it according to written code (as opposed to community decision). Gender roles become more clearly prescribed in daily life.
I think I hear u/sunagainstgold's keyboard catching fire, which hopefully means she'll take this on from the late middle ages where sexual deviance becomes a greater focus of gender politics and law.
^1 James Brundage, Law, Sex, and Christian Society in Medieval Europe (University of Chicago Press, 1987, 1990) p.314
Hrm. I'm not sure I have much to add as far as 'narrative' of masturbation in the Middle Ages goes, and I'm afraid it's really hard to find gender comparisons. But I can add a few points of evidence from different sources, and then discuss the real change that comes with the Reformation and the social changes wrapped up in how it takes shape (and, through the pernicious magic of confessionalization, which influence the Counter-Reformation as well).
First, though, we need to take a moment to appreciate how weird and awkward it must have been for monks to write about masturbation (especially gendering it). These are vowed-celibate men steeped in an ideological world of women as sinful sexual temptresses--and autoeroticism is the place where they can't escape the facts of their own bodies, whether it's the desire (mortal sin of lust) that leads one to 'give in' (sin) and masturbate, or the wet dream they cannot control but imagine they must.
Canonically, masturbation is grouped with homosexuality and bestiality as a "sin against nature", although in the hierarchy of sexual sins it is always at the bottom whereas those other two are much higher.
/u/idjet, where are you seeing that Brundage finds female masturbation a lesser sin than male? I'm on p. 167 in L,S,CS where he cites Burchard of Worms to the effect that male masturbation with the aid of an object merits 40^1 days of penance, but women masturbating with a "bulk or machine in the manner of a virile member" get a full year of bread and water (as long as they're alone).
The penitentials' understanding gets absorbed by canon law, as /u/idjet notes; it also filters into two important literary genres that were unquestionably used for religious instruction. This is monastic devotional/guidance literature and sermon exempla. This makes seeing a high=>late medieval development difficult, since the later Middle Ages tended to circulate vernacular versions of earlier Latin didactic treatises and use many of the same exempla collections (skeletal outline stories that could be inserted and expanded upon to flesh out a sermon); in fact, popular exempla go back to the early Middle Ages.
Some features that appear over and over:
A deep concern with ejaculation in the case of men, and thus a close connection between masturbation and wet dreams as sinful signs of sinful men succumbing to lust. But this is not entirely gendered, either. The 13C Middle English Ancrenne Wisse, advice for anchoresses quite popular with nuns as well, makes a very oblique reference to women's sexy dreams causing arousal by referring to its partner, sexual stimulation "wakingly and willingly." This connection seems especially apparent in sermon exempla, which is really interesting since it means preachers thought stories of wet dreams being horrifically sinful would be something appealing and helpful for instruction for their audience. By which I mean, some of these stories turn on an acceptance of the idea that wet dreams represent giving in to lust and are thus dirty and, well, sins.
A close connection between masturbation and homosexuality, for both men and women. This is already apparent in Burchard with his discussions of aided masturbation, when his first question of a set involves mutual masturbation that is then followed by a second question, "did you do this aforementioned thing, except alone? if so..." Aelred of Rievaulx, writing his own treatise of guidance for anchoresses, jumps right from condeming homosexual desire ("a man goes mad for a man, or a woman for a woman") to masturbation.
In the monastic literature especially, the idea that masturbation is sex and thus represents a loss of prized virginity runs strong. The Ancrenne Wisse outright just mentions lechery "with or without another" and "touched him in the sweet place, or myself." Autoeroticism isn't bracketed off. Aelred has it, "Often virginity is corrupted in the absence of the flesh of another".
Aelred is an incredibly rare example of explicit reference to women masturbating (outside the penitentials). Even his later translators and adapters elide his explicit references, or omit the relevant passages entirely. Let's allow his Middle English translator to explain why: "[Don't sin] in other ways, which shall not be named." The author of the Ancrenne Wisse agrees that he will not go into further detail "for fear one should learn of more evil than she already knows, and should thus be tempted. That's right, these men were either so uncomfortable with women's sexuality that they couldn't bring themselves to mention it (which seems unlikely; Schulenberg, Forgetful of Their Sex, points out that early medieval male hagiographers of nuns took a special interest in potential lesbian activity in their convents, and I really want to track down her citations on this someday)...or they believed women needed men's guidance to discover masturbation and lesbian desire. I fucking love the Middle Ages.
Monastic women wrote buckets of advice for monastic women, an unknown amount of which survives in archives scattered over Europe. It's not been published because it hasn't been considered of literary or theological merit. It's possible that there is a treasure trove of exhortations against masturbation and lesbianism here, although at least in what I know of the St. Katherina's Nuremberg-St. Katherina's St. Gall exchange, it's basically about how to run a convent. Hildegard of Bingen, who is published and views virginity as an existential state, a bedrock principle of her theology as a whole, spends a small but dedicated chunk of her Liber vite meritorum on sexual sins. All she's got is a chapter on those who had "turned human nature into contrary things," no explanations of what this entails. (She does separate out bestiality, so it's either/or homosexuality, masturbation.)
So, that's what I've got for the Middle Age. Scattered bits. Not a ton of attention to women masturbating, explicitly. I would think there would be more in 'secular' literature, but if it's there, it doesn't look like medievalists have been all that interested in discovering it. (Which may indeed mean it's not there.)
I'll head to a new post to discuss the Reformation era.
~~
^ The online PL isn't always accurate, but for what it's worth, I actually find there 20 days of bread and water for male masturbation with an object: "ut tu tuum virile membrum in lignum perforatum (perforated wood), aut in aliquod huiusmodi mitteres, ut sic per illam commotionem et delectationem a te semen projiceres? Si fecisiti, XX dies in pane et aqua poeniteas." 10 days if men use their hands (on themselves. Triple that for a circlejerk. Ladies and gentlemen, the Middle Ages).