Where does the idea of the satanic ritual with the virgin sacrifice come from?

by discworldian

Specifically within the European christian sphere, where does the cliched "virgin on a slab" human sacrifice idea come from?

Was this around in medieval Europe during the witch hunts in Germany and the Netherlands?

AncientHistory

Ultimately, the idea probably derives from images of human sacrifice in the Bible, such as the Binding of Isaac, as in Genesis 22: 9-10:

9 When they reached the place God had told him about, Abraham built an altar there and arranged the wood on it. He bound his son Isaac and laid him on the altar, on top of the wood. 10 Then he reached out his hand and took the knife to slay his son.

These in turn were based on widespread practices of animal sacrifice in the ancient Near East and around the Mediterranean. Human sacrifice was an historical practice, but like cannibalism it was more widely used as a polemic to denounce other religions - there's a large body of work on that, you might start with Human sacrifice--in history and today if you want to delve into the accounts, but let's unpack a couple of the specifics of your question:

virgin

The adoration of virginity goes back a long way; many tales of the founding of Athens involve virgin sacrifices, and find their way into the Greek tragedies. Rome hosted some of the most famous in antiquity being the Vestal Virgins, who could be subject to death if they were unchaste, which happened at least a couple times in history; you can read about some of that in the old essay Human Sacrifices at Rome The cultural significance and meaning of virginity varies throughout different societies and times, so it's hard to make a really definitive statement except that especially as Christianity began to take hold in Europe and the cult of the Virgin Mary gained prominence, virginity became associated with "purity" or "innocence." This idea was reinforced by the re-discovery and spread of Greek plays during the Renaissance, where works like Heracleidae by Euripedes include lines like:

All those who chant prophetic words have I assembled, and have examined ancient oracles, both public and secret, as means to save this city. And though the several answers differ in many points, yet in one is the sentiment of all clearly the same; they bid me sacrifice to Demeter's daughter some maiden from a noble father sprung.

This leads us to the next bit:

Was this around in medieval Europe during the witch hunts in Germany and the Netherlands?

For all that there was a special attribute of innocence attached to "virgins" which made them of extra value for sacrifice, if you look at accounts of the witch-trials most of the human sacrifices involve infants and children, especially those that are unbaptized. In Montague Summers' translation of the Malleus Maleficarum for instance includes (143):

[...] when a witch offers a child to the devil, she commends it body and soul to him as its beginning and its end in eternal damnation; wherefore not without some miracle can the child be set free from the payment of so great a debt.

The Malleus Maleficarum (1486) was issued after a lot of the individual elements of the popular idea of witchcraft had congealed - the pact with the devil, the witches' familiar, night flights, sabbats, etc. - and the idea of witchcraft and heresy were intertwined, so you have accounts which are positively theistic, such as (197):

[...] They savour of heresy in this way, that they utter nefarious prayers and offer sacrifices at the altars of idols, and they consult with devils and receive answers from them [...]

At this point, I think we've established that the idea of virgin sacrifice originated in antiquity, that idea of human sacrifice on an altar was continually available for propagation through the Bible, and that the medieval conception of witches were as heretics that literally worshiped Satan, sometimes with human sacrifice.Which leads into the next bit:

satanic ritual

The most famous Satanic ritual is the Black Mass, a perversion (or if you prefer, inversion) of the Catholic formula incorporating a number of blasphemies; while there were many heretical versions of the Mass in history, the Black Mass as we know it today largely descends from the novel Là-Bas (1891) by Joris-Karl Huysmans, which includes a description of the "altar:"

On a table serving as tabernacle a woman lay down, naked or with her skirts lifted up over her head, and with her arms outstretched. She held the altar lights during the whole office.

Guibourg thus celebrated masses on the abdomen of Mme. de Montespan, of Mme. d'Argenson, of Mme. de Saint-Pont. As a matter of fact these masses were very frequent under the Grand Monarch. Numbers of women went to them as in out rimes women flock to have their fortunes told with cards.

"The ritual of these ceremonies was sufficiently atrocious. Generally a child was kidnapped and burnt in a furnace out in the country somewhere, the ashes were saved and mixed with the blood of another child whose throat had been cut, and of this mixture a paste was made resembling that of the Manicheans of which I was speaking. Abbe Guibourge officiated, consecrated the host, cut it into little pieces and mixed it with this mixture of blood and ashes. That was the material of the Sacrament."

The murder of the children is descended fairly directly from the kind of accounts obtained in the witch-hunts, and Huysmans' Black Mass gives the image of the bound victim on the altar from antiquity, but it doesn't quite put them together. The real popularization of the archetype of the virgin-on-the-altar occurred later, and it's fairly clear that by the 1920s and 30s it was beginning to gel. For example Julian Franklyn in A Survey of the Occult (1935) states:

The first requirement in the celebration of the Black Mass is a virgin, naked, spread-eagled on the 'altar' and the climax is reached when the officiating priest performs the sexual act with her.

It's not explicit where Franklyn gets that idea from, but it seems to be a combination of Huysman's Black Mass and possibly sex magick rituals as practiced by Aleister Crowley (Crowley never performed a Black Mass, but he had a ritual known as the Gnostic Mass which shared a few similarities).

Pulp fiction also had the idea pretty firmly in the 1920s and 30s, although it wasn't uniquely associated with Satanism, but with "heathen" or magical practices in general - something of a holdover from Colonialism vilifying aspects of native religious. In Robert E. Howard's "The Hour of the Dragon" (serialized 1935-1936) for example, there is a scene:

Xaltotun stood beside the dark altarstone and stared across the valley, at the dead and wounded men on the terraces, at the grim, blood-stained band at the head of the slopes, at the dusty, steel-clad ranks reforming in the vale below. He glanced up at the sky, and he glanced down at the slim white figure on the dark stone. And lifting a dagger inlaid with archaic hieroglyphs, he intoned an immemorial invocation:

"Set, god of darkness, scaly lord of the shadows, by the blood of a virgin and the sevenfold symbol I call to your sons below the black earth! Children of the deeps, below the red earth, under the black earth, awaken and shake your awful manes! Let the hills rock and the stones topple upon my enemies! Let the sky grow dark above them, the earth unstable beneath their feet! Let a wind from the deep black earth curl up beneath their feet, and blacken and shrivel them—"

He halted short, dagger lifted. In the tense silence the roar of the hosts rose beneath him, borne on the wind.

The pulps allowed this kind of flexibility, where the old image of virgin sacrifice on altars to strange gods could be transported to different times and contexts. From a literary standpoint, virginity also allows for a certain amount of sexual tension in a scene, which may be why the idea of the "virgin sacrifice" gained popularity both as a literary trope and as a visual element for sex appeal in horror films as they grew more explicit in the 1970s and 80s. The loose Lovecraft adaptation of "The Dunwich Horror" (1970) and the Hammer Horror film "To the Devil A Daughter" (1976) really comes to mind for the specific imagery of "splayed out on the altar."