The Wise Woman Speaks to Joab from the Wallby emmanuel_higgins

2 Samuel 20:15

And they came and besieged him in Abel of Beth-maachah, and they cast up a bank against the city, and it stood in the trench: and all the people that were with Joab battered the wall, to throw it down.

This verse belongs to the closing history of the reign of David. It describes the siege connected with the revolt of Sheba the son of Bichri, which arose from a quarrel between the men of Judah and the men of Israel after Absalom's revolt was suppressed and threatened to prove a very serious thing. The episode forms part of David's difficulties and unending troubles, including his troubles with Joab.

These troubles were God's judgment for David's sin in the case of Uriah, proving that the sword would never depart from his house. On another account, the troubles in David's family grew out of his taking many wives. The detailed faithfulness with which the account is told marks it as inspired and shows that God does not hide the sins of even the greatest kings. The broader lesson is that people cannot break God's laws without suffering, because every transgression carries an inherent curse.