Nathan told David (New Living Translation) 2 Samuel 12:
Whether or not you have repented, you may still be punished.
This world is a testing ground for everyone.
Hebrews 12:
Then David repented and received forgiveness from God.9 "Why, then, have you despised the word of the LORD and done this horrible deed? For you have murdered Uriah the Hittite with the sword of the Ammonites and stolen his wife."
Whether or not you have been forgiven, you may still be punished.13 Then David confessed to Nathan, “I have sinned against the LORD.”
Nathan replied, “Yes, but the LORD has forgiven you, and you won’t die for this sin. 14 Nevertheless, because you have shown utter contempt for the word of the LORDa by doing this, your child will die.”
Whether or not you have repented, you may still be punished.
This world is a testing ground for everyone.
Hebrews 12:
7 Endure hardship as discipline; God is treating you as his children. For what children are not disciplined by their father?