Repentance is vital. But consequences still come...
While we see clear repentance on the part of David in these verses, as well as the forgiveness of God, Nathan made it clear to David that consequences were coming.
1) The "sword would not leave his house". Violence, Rape, other sexual sins, and death would occur in David's family--consequences of his sin against Bathsheba. Even the death of the baby that David and Bathsheba had conceived, died.
2) Evil in his own house would rise up against him and sleep with his wives. Absalom did that. Such deep sin.