Because Jesus' message was forgiveness of sins. Not condemnation for them.
Leviticus 20 (ESV)
10 “If a man commits adultery with the wife of[a] his neighbour, both the adulterer and the adulteress shall surely be put to death.
I immediately notice 2 things here. The first is that both parties of adultery are to be condemned. And second that this looks a lot like a civil law, to be enforced not by a mob, but by the authorities.
This gets into the tripartite division of the law. Depending on how you slice it, there are three forms of law given in the Old Testament
Christians generally acknowledge that the Ceremonial law was fulfilled by Jesus, that the moral law is still in effect and that the civil law is tricky, but was largely given for the state of Israel to run smoothly. The general advice I've heard on the civil law is that if it can be boiled down to a principal then that is what we should draw from it (in the case of this Leviticus passage we can probably take a few things, I'll leave that to the reader though as it's not exactly relevant to this answer).
But ultimately, the answer to your question comes from why Jesus came to the earth, lived the life that he lived, died the death that he did and resurrected as he did and ascended into heaven like he did.
IF Jesus had come to establish an earthly kingdom, the kick off Roman rule and re-establish the kingdom of Israel as an earthly kingdom, he would not have stopped the mob. He might have allowed the punishment that was proscribed in the scriptures to continue. He likely would have ordered her partner in adultery to be brought forth as well and stoned.
But that wasn't his mission, and that was not what he did.
Let's not lose the context here either. This was a trap. Matthew Henry in his commentary lays it out like this:
If he should confirm the sentence of the law, and let it take its course, they would censure him as inconsistent with himself (he having received publicans and harlots) and with the character of the Messiah, who should be meek, and have salvation, and proclaim a year of release; and perhaps they would accuse him to the Roman governor, for countenancing the Jews in the exercise of a judicial power. But, [2.] If he should acquit her, and give his opinion that the sentence should not be executed (as they expected he would), they would represent him, First, As an enemy to the law of Moses, and as one that usurped an authority to correct and control it, and would confirm that prejudice against him which his enemies were so industrious to propagate, that he came to destroy the law and the prophets. Secondly, As a friend to sinners, and, consequently, a favourer of sin; if he should seem to connive at such wickedness, and let it go unpunished, they would represent him as countenancing it, and being a patron of offences, if he was a protector of offenders, than which no reflection could be more invidious upon one that professed the strictness, purity, and business of a prophet.
Why hello Admiral, yes, yes it was.
Either way Jesus was stuck. However, by turning the accusation on the woman's captors, by highlighting their own sin/imperfection, he was showing the following things:
He was showing that we are all condemned by our sins.
He was highlighting his own mission of forgiveness and the call to repentance
He confirms the law of Moses, the just punishment of the woman and the fact that the men before him were unrepentant violators of the law who were not fit to carry out the sentence.
He builds upon an uncontested maxim in morality, that it is very absurd for men to be zealous in punishing the offences of others, while they are every whit as guilty themselves, and they are not better than self-condemned who judge others, and yet themselves do the same thing: "If there be any of you who is without sin, without sin of this nature, that has not some time or other been guilty of fornication or adultery, let him cast the first stone at her.’’ Not that magistrates, who are conscious of guilt themselves, should therefore connive at others’ guilt. But therefore, (a. ) Whenever we find fault with others, we ought to reflect upon ourselves, and to be more severe against sin in ourselves than in others. (b. ) We ought to be favourable, though not to the sins, yet to the persons, of those that offend, and to restore them with a spirit of meekness, considering ourselves and our own corrupt nature.
This reminds me of another of Jesus' parables. Matthew 18 (ESV)
23 “Therefore the kingdom of heaven may be compared to a king who wished to settle accounts with his servants.[h] 24 When he began to settle, one was brought to him who owed him ten thousand talents.[i] 25 And since he could not pay, his master ordered him to be sold, with his wife and children and all that he had, and payment to be made. 26 So the servant[j] fell on his knees, imploring him, ‘Have patience with me, and I will pay you everything.’ 27 And out of pity for him, the master of that servant released him and forgave him the debt. 28 But when that same servant went out, he found one of his fellow servants who owed him a hundred denarii,[k] and seizing him, he began to choke him, saying, ‘Pay what you owe.’ 29 So his fellow servant fell down and pleaded with him, ‘Have patience with me, and I will pay you.’ 30 He refused and went and put him in prison until he should pay the debt. 31 When his fellow servants saw what had taken place, they were greatly distressed, and they went and reported to their master all that had taken place. 32 Then his master summoned him and said to him, ‘You wicked servant! I forgave you all that debt because you pleaded with me. 33 And should not you have had mercy on your fellow servant, as I had mercy on you?’ 34 And in anger his master delivered him to the jailers,[l] until he should pay all his debt. 35 So also my heavenly Father will do to every one of you, if you do not forgive your brother from your heart.”
Calvin's commentary has an even more interesting point. It was not for Jesus to stone the woman even if he had wanted to. It was up to the accuser to mete out the punishment:
He who is without sin among you. He said this according to the custom of the Law; for God commanded that the witnesses should, with their own hands, put malefactors to death, according to the sentence which had been pronounced on them; that greater caution might be used in bearing testimony, (Deuteronomy 17:7.) There are many who proceed rashly to overwhelm their brother by perjury, because they do not think that they inflict a deadly wound by their tongue. And this very argument, had weight with those slanderers, desperate as they were; for no sooner do they obtain a sight of it, than they lay aside those fierce passions with which they were swelled when they came. Yet there is this difference between the injunction of the Law and the words of Christ, that in the Law God merely enjoined that they should not condemn a man with the tongue, unless they were permitted to put him to death with their own hands; but here Christ demands from the witnesses perfect innocence, so that no man ought to accuse another of crime, unless he be pure, and free from every fault. Now what he said, at that time, to a few persons, we ought to view as spoken to all, that whoever accuses another, ought to impose on himself a law of innocence; otherwise, we do not pursue wicked actions, but rather are hostile to the persons of men.