Exodus 22:18 is in a larger framework of civil and criminal laws being set down with the intention of creating a just society. The formulation of these laws are quite common among ancient Near Eastern societies, and we even see some laws that are similar to laws we see outside of the Israelite community. To watch this episode, go to: https://www.youtube.com/watch?v=0hH-SF2ZJNM
So what we are seeing as a whole is an attempt by the Israelites to begin forming the foundation of a new nation.
Verse 18, or verse 17 when looking at the Hebrew Tanakh, is in a section that is looking more at ethical and religious considerations, which begin a second set of laws in this framework.
I want to take a quick side step here. While both the Torah and Talmud allow for capital punishment, but it was something very rarely carried out. There is a passage in the Mishnah that says that a sanhedrin that executes once in seventy years is murderous. And while the Talmud allowed for capital punishment, it also made it exceptionally difficult, and exceedingly rare for such a penalty to be handed down.
Even in the Torah, one could only be put to death on the testimony of two people, and the witnesses who testified had to be the first to throw the stones to kill the guilty party.
So while the death penalty was an option, it was something quite rare even though there were a variety of laws that prescribed it.
Anyway, back to verse 17. There it says simply, No witch shall you let live or, you shall not tolerate (literally, let live) a sorceress.
A couple of notes. It implied there that a witch or sorceress here is feminine, and that was because females were predominate in the practice. But it doesn’t exclude males, and we see in Deuteronomy 18:10, males also being specifically banned from sorcery.
When talking about witchcraft here though, it isn’t something like Wiccans. Instead, we have a variety of terms that are used to distinguish between practices. Sorcery was deemed more antisocial and had a more negative connotation.
This is an important distinction as we do see in other places where magic is seen more in a neutral or positive term. But if we look at many of the places where sorcery or magic is condemned, it is often associated with outsiders, as something foreign.
Getting back to the passage, when looking at a sorceress, or a witch, we are looking at a practitioner of malevolent magic. It’s punished severely because it was seen as antisocial behavior, and dangerous. Some commentators even suggested that a seducer may resort to sorcery to have his way with a young woman.
So we are looking at a practice that was associated with evil deeds, and that it why it was given such a harsh punishment.
In the end, what we have is a group of people, who truly believed sorcery was real, that it was used for terrible deeds, and because of that, a severe punishment was needed. In light of that, one can see some logic in the thought process.