It hurt God. The price for sin is very heavy. David and Bathsheba both deserved to be stoned. Even though David would be forgiven he still had to receive the natural consequences of sin. Before your very eyes I will take your wives and give them to one who is close to you, and he will lie with your wives in broad daylight.
Sin has weighty ramifications.
Even though we might receive full forgiveness, we still have to reap the physical consequences of what we have sown. First the baby born to Bathsheba died. Things were in constant turmoil till David died. David's son Amnon raped his sister Tamar. Absalom murdered his brother and attacked David.