In these passages is the account of Amnon, one of David’s sons, raping Amnon’s half-sister Tamar. Tamar was David’s daughter by another wife and full sister of David’s son, Abasalom. This event led to Absalom killing his brother Amnon.
This is but one of the methods that God used to punish David for his sin with Uriah’s wife Bathsheba. God told David through Nathan the prophet, that ‘the sword would not depart from David’s house’ because David killed Uriah to cover up his sin with Bathsheba.
I believe that we are punished for our sins in similar manner of the sins we commit. For example, if we lie, we may be lied to. If we steal, someone may steal from us. If we gossip about others, others may gossip about us. And so it goes.
One thing is for sure. Sinning will lead to unpleasantness in our lives. This alone should provide motivation not to sin. When we are tempted, we must have the wisdom to look beyond the sin we are contemplating and consider the consequence. This will help to remove the temptation.