Then the king was deeply moved, and went up to the chamber over the gate, and wept. And as he went, he said thus: “O my son Absalom—my son, my son Absalom—if only I had died in your place! O Absalom my son, my son!” 2 Samuel 18:33
Absalom staged a rebellion and King David fled Jerusalem. For all he knew, Absalom was out to kill him.
Yet, upon hearing about Absalom’s death, King David mourned and cried aloud – actually desiring that Absalom had lived and he had died.
This did not set well with Joab, the captain of the army and the man responsible for Absalom’s death. In fact, Joab gave the king quite a tongue lashing .(2 Sam 19:5-7)
David has a heart for God and for people.
It’s easy to rejoice when someone you dislike has misfortune. It’s easy to say “they got what they deserve.”
However, another son of David would become king and pen this – Do not rejoice when your enemy falls, and do not let your heart be glad when he stumbles; Lest the Lord see it, and it displease Him, and He turn away His wrath from him. Prov 24:17-18
When you have a heart and concern for the spiritual well-being of others, then you pray for them. When misfortune happens to them, you find yourself concerned and praying rather than rejoicing.
This is the heart of God.