Jerusalem's King Adoni-zedek heard that Joshua had captured Ai and had wiped it out as something reserved for God. Joshua did the same thing to Ai and its king that he had done to Jericho and its king. He also heard that the population of Gibeon had made peace with Israel and were living among them.
References for Joshua 10:1
Adoni-zedek and his people were very afraid, because Gibeon was a large city, like one of the royal cities. It was larger than Ai. All its men were soldiers.
References for Joshua 10:2
So Jerusalem's King Adoni-zedek sent word to Hebron's King Hoham, Jarmuth's King Piram, Lachish's King Japhia, and Eglon's King Debir:
"Come up and help me. We will strike at Gibeon, because it has made peace with Joshua and with the Israelites."
Then the five kings of the Amorites gathered. These were the kings of Jerusalem, Hebron, Jarmuth, Lachish, and Eglon. They went up with all their armies, camped against Gibeon, and attacked it.
The people of Gibeon sent word to Joshua in the camp at Gilgal: "Don't desert your servants! Come to us quickly. Rescue us! Help us! All the Amorite kings from the highlands have assembled together against us."
So Joshua went up from Gilgal with the entire army and all the bravest soldiers.
Then the LORD said to Joshua, "Don't be afraid of them. I have given them into your power. Not a single one of them can stand up against you."
References for Joshua 10:8
Joshua quickly attacked them, having come up overnight from Gilgal.
Then the LORD threw them into a panic before Israel. Joshua struck a mighty blow against them at Gibeon. He chased them on the way up to Beth-horon and struck them down as far as Azekah and Makkedah.
When they were fleeing from Israel and were on the slope of Beth-horon, the LORD threw down large stones from the sky all the way to Azekah. So they died. More died from the hailstones than the Israelites killed with the sword.
On the day the LORD gave the Amorites into the power of Israel, Joshua spoke to the LORD in the presence of the Israelites: "Sun, stand still at Gibeon! and Moon, at the Aijalon Valley!"
The sun stood still and the moon stood motionless until a nation took revenge on its enemies. Isn't this written in the Jashar scroll? So the sun stood motionless in the middle of the sky. For a whole day, it was in no hurry to go down.
There hasn't been a day like it before or since, when the LORD responded to a human voice. The LORD fought for Israel.
Then Joshua along with all Israel came back to the camp at Gilgal.
Then those five kings fled and hid in the cave at Makkedah.
References for Joshua 10:16
It was reported to Joshua, "The five kings have been found, hidden in the cave at Makkedah."
Joshua said, "Roll large stones over the mouth of the cave. Station some men by it to guard them,
but don't you stay there. Chase after your enemies and attack them from the rear. Don't let them enter their cities, because the LORD your God has given them into your power."
Joshua and the Israelites finished dealing them a stunning blow until they were finished off. Some survivors among them escaped into the fortified cities.
Then the whole people came back safely to Joshua in the camp at Makkedah. Not a single person threatened the Israelites.
Joshua said, "Open up the mouth of the cave. Bring those five kings out of the cave to me."
They did so. They brought the five kings out of the cave to him: the kings of Jerusalem, Hebron, Jarmuth, Lachish, and Eglon.
When they brought these kings out to Joshua, Joshua called for every Israelite. He said to the military commanders who had gone out with him, "Come forward. Put your feet on the necks of these kings." So they went forward and put their feet on their necks.
Then Joshua said to them, "Don't be afraid or terrified. Be brave and strong, because this is how the LORD will deal with all the enemies you fight."
Next, Joshua struck them down. He put them to death and then hanged them on five trees. They were hanging on the trees until evening.
At sundown, Joshua gave an order, and they took them down from the trees. They threw them into the cave where they had hidden themselves, and they set large stones over the mouth of the cave. The stones are still there to this very day.
On that day, Joshua captured Makkedah. With a sword, he struck it and its king without mercy. He wiped them out, treating everyone in the city as something reserved for God. He left no survivors. He did to the king of Makkedah exactly as he had done to the king of Jericho.
References for Joshua 10:28
Then Joshua along with all Israel moved on from Makkedah to Libnah. They attacked Libnah.
The LORD also gave it and its king into the power of Israel. With a sword, he struck it and everyone in it without mercy. He left no survivors in it. He did to its king exactly as he had done to the king of Jericho.
Joshua along with all Israel moved on from Libnah to Lachish. They camped near it and attacked it.
The LORD gave Lachish into the power of Israel. Joshua captured it on the second day. With a sword, he struck it and everyone in it without mercy, just exactly as he had done to Libnah.
Then Gezer's King Horam came up to help Lachish. But Joshua struck him and his people down, until no survivors were left.
Joshua along with all Israel moved on from Lachish to Eglon. They camped against it and attacked it.
They captured it on the same day and struck it down without mercy. On that day, he wiped out everyone in it as something reserved for God, just exactly as he had done to Lachish.
Joshua along with all Israel went up from Eglon to Hebron and attacked it.
They captured it and struck it down without mercy, along with its king, all its towns, and everyone in it. He left no survivors, just exactly as he had done to Eglon. He wiped out the city and everyone in it as something reserved for God.
Joshua along with all Israel turned back to Debir and attacked it.
He captured it along with its king and all its cities. They struck them down without mercy and wiped out everyone in it as something reserved for God. He left no survivors. Exactly as he had done to Hebron, so he did to Debir and its king—exactly as he had done to Libnah and its king.
So Joshua struck at the whole land: the highlands, the arid southern plains, the lowlands, the slopes, and all their kings. He left no survivors. He wiped out everything that breathed as something reserved for God, exactly as the LORD, the God of Israel, had commanded.
Joshua struck them down from Kadesh-barnea to Gaza, and the whole land of Goshen as far as Gibeon.
Joshua captured all these kings and their land all at the same time. This was because the LORD, the God of Israel, fought for Israel.
Then Joshua along with all Israel came back to the camp at Gilgal.