Leviticus 20:10
And the man that committeth adultery with another man’s wife, even he that committeth adultery with his neighbour’s wife, the adulterer and the adulteress shall surely be put to death. And the man that committeth adultery with another man’s wife, even he that committeth adultery with his neighbour’s wife, the adulterer and the adulteress shall surely be put to death.
Adultery with another man's wife, even with a neighbor's wife, was a capital offense punishable by death. The law named both the adulterer and the adulteress as liable, requiring equal punishment for both guilty parties. The prescribed death was carried out by stoning, with the offenders taken outside the camp to be stoned.
Under the law the husband was responsible for bringing the charge, so accusers who did not follow its provisions had no authority to proceed as they did. The law was invoked against a woman caught in adultery, with the accusers describing the required penalty as stoning, in order to test Jesus and find grounds to accuse Him and trap Him. The trap presented a dilemma in which acquitting her would allow accusation that He despised Moses' law, while condemning her would allow accusation to the Romans that He claimed authority belonging to them, so they intended to accuse Him whether He upheld or rejected the sentence. In that case the accusers were themselves guilty of hidden sins, and when exposed they were convicted by conscience and left rather than carry out the sentence, since none was fit to condemn her.
Because Bathsheba was Uriah's wife, David's adultery made him guilty of this capital offense, and the law's sentence together with the possibility of Uriah's personal vengeance or a national revolt made the consequences grave. The stoning system has ended and been abolished, but the penalty for breaking God's law has not ended; unless the transgressor heartily repents, the doom remains temporal and eternal death, the second death of everlasting destruction from the Lord's presence. Adultery remains an enormous, known, grave sin and not a small or minor offense; the end of stoning led people to indulge it more freely and treat it lightly, but treating it lightly brings God's displeasure upon the church.