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." (2 Samuel 12:14)
There will always be consequences for sin, even forgiven sin. God forgave David, but the ramifications of his sin demanded justice in that the sword never left his house. Was David forgiven? Yes he was; nevertheless sin scars just as a wound leaves a blemish after it heals. David's sin merited the death sentence, but God in his mercy commuted his sentence. There is a great lesson to be learned from Saul and David, Saul sinned, but did not seek forgiveness; he sought justification. When David sinned, he never attempted to justify himself; he quickly and earnestly sought forgiveness. He always confessed his sin, realizing to whom he had sinned against. Let us heed his words when had committed adultery with Bathsheba and murdered Uriah, "For I acknowledge my transgressions, and my sin is always before me. Against You, You only, have I sinned, and done this evil in Your sight."