David said to Nathan, “I have sinned against the LORD.” And Nathan said to David, “The LORD also has put away your sin; you shall not die.
It seems to have been a great while after David had been guilty of adultery with Bath-sheba before he was brought to repentance for it. For, when Nathan was sent to him, the child was born (Sa2 12:14), so that it was about nine months that David lay under the guilt of that sin, and, for aught that appears, unrepented of.
Commenting on 2 Samuel 12:1-14
Howbeit, because by this deed,.... This complicated wickedness, adultery with Bathsheba, and the murder of her husband, and occasioning the death of others: thou hast given great reason to the enemies of the Lord to blaspheme; to insult over Israel, and the God of Israel, and to magnify their own idols on account of the advantage they got when Uriah and other Israelites were slain...
And David said unto Nathan, I have sinned against the LORD. And Nathan said unto David, The LORD also hath put away thy sin; thou shalt not die. (g) For the Lord seeks the sinner to turn to him.