This passage (John 8) is frequently misunderstood. The command in Scripture is against one participating in an execution if he himself was complicit in that same crime. God's Law never required absolute sinlessness on the part of the people before they could execute a rapist or murderer. Only that they not be a part of that same crime.
In John 8, the religious leaders of Jesus' day -- who Jesus says were the most evil people in history (Matthew 23:35) -- brought an adulteress before Jesus. These men claimed to be the great "defenders" of God's Law, and they claim to be so very concerned about the details of the law, and outraged that they caught a woman in the very act of adultery, so they bring the woman before Jesus to see if Jesus is as passionate a defender of the Law as they are.
The Law of God commanded that BOTH the man and the woman be punished (Leviticus 20:10). Yet the man is not there. WITH WHOM was the woman caught in adultery -- "in the very act?" Why is the other party not here as well?
We can tell already that this whole thing is a fraud and a set-up.
Jesus frequently accused the religious leaders of being "adulterous" (e.g., Mark 8:38), and as they one-by-one slithered away like snakes, leaving only the woman, it became clear that these men were probably the ones who committed adultery with her. Thus the woman could not be stoned under Old Testament law, because there were no qualified witnesses to testify against her (an absolute requirement under the law) (Deut 17:7).
Thus the woman could not have been convicted of the crime of adultery under Old Testament law, so it is no wonder that Jesus did not advocate her stoning. Jesus kept the OT law perfectly.
Analyzing John 8: The Woman Taken in Adultery | Gary North
The following are Bahnsenís words on the passage (from Theonomy in Christian Ethics, pp.231-32):
ď[E]ven if this passage be accounted as part of the infallible autograph of Johnís gospel, rather than weakening the present thesis, it strongly confirms it! Christ demands that the very details of the Mosaic law be followed in John 8:7. The Pharisees who brought the adulteress before Jesus were more concerned with trapping Jesus in a statutory dilemma than in the sanctity of Godís moral law; they intended to trap Him between upholding the Older Testamental law and submitting to Roman law which reserved for itself the sole right to inflict the death penalty. However, the scribes were the ones who ended up being caught by their own woeful ignorance of Godís law. They came to test Jesus, but as elsewhere, they failed to know the law. God requires, in conviction for capital crimes, that the witnesses who bring the accusation against a person be innocent of that very same crime (Deut. 19:15); furthermore, the law specified that in the event of capital punishment the accusers had to cast the first stones (Deut. 17:7). Christ was merely enforcing the precise demands of Godís holy law in John 8: 7; the one who was without sin should cast the first stone, 'O anamarthtos (ďone who has not sinnedĒ) might possibly be taken as a reference to God (The Sinless One) or to any human executor that happened to be free from all sin; however, both of these interpretations are impossible. Christ is not saying that the only person who can execute a violator of a capital crime is one who has no sin whatsoever, for this would contradict Romans 13:4 (which, when written, applied to sinful Rome and its debauched emperors). And a reference to God casting a stone in order to punish a sinner in this passage would be absurd and irrelevant to the situation. 'O anamarthtos refers to one who has not committed the particular sin of adultery; the word is used to denote innocence of an individual type of sin (rather than all sin) in extrabiblical literature (e.g., 2 Macc. 12:42, where Judas prays that his men be kept free from particular sin after discovering that slain soldiers had been specifically unlawful by wearing idolatrous tokens). The womanís accusers, then, either were not witnesses or were not free of adultery; hence Christ dismisses her with the admonition to sin no more. The law protects the rights of accused individuals and demands that the case against them be solid and legal before they are deprived of their lives. John 7:53-8:11, even if authentic, does not support the relaxing of the details of Godís law; it harmonizes with Christís words in Matthew 5:17 f. to the effect that every jot and tittle of Godís law remain valid until the end of the world.Ē