A lot happens in this chapter and most of it is not related. Remember, David rapes Bathsheba and kills her husband. Chapter 12 begins with the very simple statement that this did not please the Lord. So God uses David's prophet, Nathan, to not only accuse him and tell him of his punishment, but also to tell him the story. Jesus teaches consistently in parables and here we find Nathan doing the same. He sets David up to fire him up about someone who takes advantage of a poor little lamb. David tells Nathan that the owner of the lamb who was wronged should be paid double.
That would be nice if the owner were alive, but Uriah was killed. Nathan accuses David and David takes it. I mean, he doesn't try to justify it or even say that it didn't happen, but rather states that he had sinned against the Lord. Nathan tells David, that's okay, you won't die, but you will be punished. This is crucial. David still is punished even though he confesses and says, for all intents and purposes, that he was sorry. The punishment is not insignificant. The child who was born of this rape will be killed. And sure enough, it happens.
Next step is that another child is conceived and born from David and Bathsheba and that is the famous Solomon. Already early on we read in vs. 24 that "the Lord loved him." David wins a crown in the next verses and the chapter ends. What drama there is in this chapter. But keep in mind that each step leads us to a recognition that while David is King, God is in charge. That would be a good thing for leaders to remember.