Just Punishment
(י) וְאִישׁ אֲשֶׁר יִנְאַף אֶת אֵשֶׁת אִישׁ אֲשֶׁר יִנְאַף אֶת אֵשֶׁת רֵעֵהוּ מוֹת יוּמַת הַנֹּאֵף וְהַנֹּאָפֶת.
(10) And the man that committeth adultery with another man’s wife, even he that committeth adultery with his neighbour’s wife, both the adulterer and the adulteress shall surely be put to death.

John 8:1-11 (New American Standard Bible)
But Jesus went to the Mount of Olives. Early in the morning He came again into the temple, and all the people were coming to Him; and He sat down and began to teach them. The scribes and the Pharisees brought a woman caught in adultery, and having set her in the center of the court, they said to Him, “Teacher, this woman has been caught in adultery, in the very act. Now in the Law, Moses commanded us to stone such women; what then do You say?” They were saying this, testing Him, so that they might have grounds for accusing Him. But Jesus stooped down and with His finger wrote on the ground. But when they persisted in asking Him, He straightened up, and said to them,“He who is without sin among you, let him be the first to throw a stone at her.” Again He stooped down and wrote on the ground. When they heard it, they began to go out one by one, beginning with the older ones, and He was left alone, and the woman, where she was, in the center of the court. Straightening up, Jesus said to her, “Woman, where are they? Did no one condemn you?” She said, “No one, Lord.” And Jesus said, “I do not condemn you, either. Go. From now on sin no more.”

Speaker For the Dead, Orson Scott Card, pp. 277-278

A great rabbi stands teaching in the marketplace. It happens that a husband finds proof that morning of his wife's adultery, and a mob carries her to the marketplace to stone her to death. (There is a familiar version of this story, but a friend of mine, a speaker for the dead, has told me of two other rabbis that faced the same situation. Those are the ones I'm going to tell you.)

The rabbi walks forward and stands beside the woman. Out of respect for him the mob forbears, and waits with the stones heavy in their hands. "Is there anyone here," he says to them, "who has not desired another man's wife, another woman's husband?"

They murmur and say, "We all know the desire. But, Rabbi, none of us has acted on it."

The rabbi says, "Then kneel down and give thanks that God made you strong." He takes the woman by the hand and leads her out of the market. Just before he lets her go, he whispers to her, "Tell the lord magistrate who saved his mistress. Then he'll know I am his loyal servant."

So the woman lives, because the community is too corrupt to protect itself from disorder.

Another rabbi, another city. He goes to her and stops the mob, as in the other story, and says, "Which of you is without sin? Let him cast the first stone."

The people are abashed, and they forget their unity of purpose in the memory of their own individual sins. Someday, they think, I may be like this woman, and I'll hope for forgiveness and another chance. I should treat her the way I wish to be treated.

As they open their hands and let the stones fall to the ground,the rabbi picks up one of the fallen stones, lifts it high over the woman's head, and throws it straight down with all his might. It crushes her skull and dashes her brains onto the cobblestones.

"Nor am I without sin," he says to the people. "But if we allow only perfect people to enforce the law, the law will soon be dead, and our city with it."

So the woman died because her community was too rigid to endure her deviance.

(יז) וְאִישׁ כִּי יַכֶּה כָּל נֶפֶשׁ אָדָם מוֹת יוּמָת. (יח) וּמַכֵּה נֶפֶשׁ בְּהֵמָה יְשַׁלְּמֶנָּה נֶפֶשׁ תַּחַת נָפֶשׁ. (יט) וְאִישׁ כִּי יִתֵּן מוּם בַּעֲמִיתוֹ כַּאֲשֶׁר עָשָׂה כֵּן יֵעָשֶׂה לּוֹ. (כ) שֶׁבֶר תַּחַת שֶׁבֶר עַיִן תַּחַת עַיִן שֵׁן תַּחַת שֵׁן כַּאֲשֶׁר יִתֵּן מוּם בָּאָדָם כֵּן יִנָּתֶן בּוֹ. (כא) וּמַכֵּה בְהֵמָה יְשַׁלְּמֶנָּה וּמַכֵּה אָדָם יוּמָת. (כב) מִשְׁפַּט אֶחָד יִהְיֶה לָכֶם כַּגֵּר כָּאֶזְרָח יִהְיֶה כִּי אֲנִי יְהוָה אֱלֹהֵיכֶם.
(17) And he that smiteth any man mortally shall surely be put to death. (18) And he that smiteth a beast mortally shall make it good: life for life. (19) And if a man maim his neighbour; as he hath done, so shall it be done to him: (20) breach for breach, eye for eye, tooth for tooth; as he hath maimed a man, so shall it be rendered unto him. (21) And he that killeth a beast shall make it good; and he that killeth a man shall be put to death. (22) Ye shall have one manner of law, as well for the stranger, as for the home-born; for I am the LORD your God.’

Babylonian Talmud, Tractate Bava Kamma, 83b

It was taught in a Baraita: R. Dostai Ben Yehuda says When the Torah states, "An eye for an eye," it refers to money. [An objection is raised:] You say that it refers to money. Perhaps it is not so and the reference is to an actual eye. But what if the eye of one is large and the other small? How can I apply the penalty 'an eye for an eye' to that case? The verse must therefore mean a monetary payment.

The Gemara further develops the ruling that only monetary compensation is permitted:

And suppose the argument is made that should rule in any case like this one, where there is a difference in the value of the eyes of the victim and the assailant, that the victim takes money from the assailant. But, where the eyes are of equal size the assailant must actually lose his eye. The proper response is that in the same passage where the rule of "an eye for an eye" is stated, the Torah also says, "there shall be one law for you," (Lev. 24:22) which teaches that there shall be the same law for all of you; that is, the penalty for all wounding cases must be the same. Since we cannot blind the assailant in all cases, we exact monetary payment in all cases.

(מו) (מו) אמר הכוזרי: האם לא נאמר אצלנו דין ענשים מפרש בתורה עין תחת עין שן תחת שן כאשר יתן מום באדם כן ינתן בו: (מז) (מז) אמר החבר: האם לא נאמר בסמוך לזה ומכה נפש בהמה ישלמנה נפש תחת נפש האין זה תשלום כפר אין הכתוב אומר אדם שהרג סוסך הרג סוסו כי מה בצע בהרגך את סוסו וכן אדם שקטע ידך קח כפר ידך כי מה בצע בכרתך את ידו אף כי דינים שיש בהם משום סתירה לשכל הישר פצע תחת פצע חבורה תחת חבורה וכי איך נוכל לשער זאת יתכן כי האחד מהם ימות מפצעו זה והשני לא ימות מפצע דומה לזה ואיך נדאג לדבר כי יהיה הפצע אשר יושם בו דומה בדיוק לפצע אשר שם בחברו כיצד נעור עינו של אדם אשר אין לו כי אם עין אחת ככפר לעוור עינו של אדם אשר לו שתי עינים וישאר זה עור בשתי עיניו שעה שהאחר יהיה עור רק בעינו האחת והרי התורה אמרה כאשר יתן מום באדם כן ינתן בו אך למה לדבר אתך על הפרטים האלה אחרי אשר הקדמתי לך עד כמה רב הצרך במסרת וכמה נאמנים מקבליה ומה רבה גדלתם והשתדלותם בשמירתה:

46. Al Khazari: Does not our Torah teach retaliation, viz. 'eye for eye, tooth for tooth, as he hath caused a blemish in man, so shall be done to him' (Leviticus 24:20)?

47. The Rabbi: And is it not said immediately afterwards: 'And he that killeth a beast shall make it good, life for life'? (Leviticus 24:18-21). Is this not the principle of ransom? It is not said: 'If anyone kills thy horse, kill his horse,' but 'take his horse, for what use is it to thee to kill his horse?' Likewise: If anyone has cut off thy hand, take the value of his hand; for cutting off his hand profits thee not. The sentence: 'Wound for wound and stripe for stripe' (Exodus 21:25), embodies ideas antagonistic to common sense. How can we determine such a thing? One person may die from a wound, whilst another person may recover from the same. How can we gauge whether it is the same? How can we take away the eye of a one-eyed person in order to do justice to a person with two eyes, when the former would be totally blind, the latter still have one eye? The Tōrāh teaches: As he hath caused a blemish in man, so shall be done to him. What further need is there to discuss these details, when we have just set forth the necessity of tradition, the truthfulness, loftiness, and religious zeal of traditionists?

The Quran, 24:2 An-Nur

The woman and the man guilty of adultery or fornication (zinaa), flog each of them with a hundred stripes: Let not compassion move you in their case, in a matter prescribed by Allah, if ye believe in Allah and the Last Day: and let a party of the Believers witness their punishment.

Hadith Al-Bukhari, 83:37

By Allah, Allah's Apostle never killed anyone except in one of the following three situations: (1) A person who killed somebody unjustly, was killed (in Qisas,) (2) a married person who committed illegal sexual intercourse (zinaa) and (3) a man who fought against Allah and His Apostle and deserted Islam and became an apostate."

Shari'a, Wa'el Hallaq, pp. 310-311

The severe sanctions applied to Ḥudūd offenses were intended to deter and were thus infrequently implemented in practice. This is exceedingly clear from the strict evidential procedures required to prove them. Yet, the harsh penalties inflicted on Ḥudūd transgressors represented only one element of their value as deterrence, the other being their enshrinement in the here and now. Their commission, when not punished in this world, landed the offender in eternal Hellfire, an eschatological notion that tended to engender moral compliance on a deep psychological level.

The extreme economy with which the Ḥudūd were invoked was motivated by the maxim, generated from a prophetic Ḥadith, that they had to be "averted at the existence of the slightest doubt." [...] Each add was bounded by relevant evidentiary rules, these rules were highly constricting, exclusionary and demanding. It would not be an exaggeration to state that cases of zinaa and theft, the only offenses that required, respectively, capital punishment or mutilation — aside from highway robbery — were, short of confession, nearly impossible to establish.

A charge of zinaa must be proven by four trustworthy male witnesses who must all appear in the same court session to testify, in extreme detail and in unambiguous language, that they saw the couple engage in sexual activity and that the man penetrated the woman to the extent that "his penis has entirely disappeared from sight." The Twelver-Shi'ites admit the testimony of three men and two women or two men and four women. The Ḥanafites, Malikites, Ḥanbalites and Twelver-Shi'ites require all witnesses to appear in court simultaneously, failing which requirement, their testimony will be rejected and all of them will be charged with qadhf, or wrongful accusation of zinaa. Upon cross-examination by the judge, any discrepancy in their testimonies (with regard, inter alia, to the place in which the act occurred and the manner of their being "with each other") will vindicate the accused and, furthermore, expose the witnesses themselves to the charge of qadhf, an offense punishable by eighty lashes.