There was a famine during David's reign that lasted for three years, so David asked the LORD about it. And the LORD said, "The famine has come because Saul and his family are guilty of murdering the Gibeonites."
So King David summoned the Gibeonites. They were not part of Israel but were all that was left of the nation of the Amorites. Israel had sworn not to kill them, but Saul, in his zeal, had tried to wipe them out.
David asked them, "What can I do for you to make amends? Tell me so that the LORD will bless his people again."
"Well, money won't do it," the Gibeonites replied. "And we don't want to see the Israelites executed in revenge." "What can I do then?" David asked. "Just tell me and I will do it for you."
Then they replied, "It was Saul who planned to destroy us, to keep us from having any place at all in Israel.
So let seven of Saul's sons or grandsons be handed over to us, and we will execute them before the LORD at Gibeon, on the mountain of the LORD." "All right," the king said, "I will do it."
References for 2 Samuel 21:6
David spared Jonathan's son Mephibosheth, who was Saul's grandson, because of the oath David and Jonathan had sworn before the LORD.
References for 2 Samuel 21:7
But he gave them Saul's two sons Armoni and Mephibosheth, whose mother was Rizpah daughter of Aiah. He also gave them the five sons of Saul's daughter Merab, the wife of Adriel son of Barzillai from Meholah.
References for 2 Samuel 21:8
The men of Gibeon executed them on the mountain before the LORD. So all seven of them died together at the beginning of the barley harvest.
Then Rizpah, the mother of two of the men, spread sackcloth on a rock and stayed there the entire harvest season. She prevented vultures from tearing at their bodies during the day and stopped wild animals from eating them at night.
When David learned what Rizpah, Saul's concubine, had done,
he went to the people of Jabesh-gilead and asked for the bones of Saul and his son Jonathan. (When Saul and Jonathan had died in a battle with the Philistines, it was the people of Jabesh-gilead who had retrieved their bodies from the public square of the Philistine city of Beth-shan.)
So David brought the bones of Saul and Jonathan, as well as the bones of the men the Gibeonites had executed.
He buried them all in the tomb of Kish, Saul's father, at the town of Zela in the land of Benjamin. After that, God ended the famine in the land of Israel.