“Then Horam king of Gezer came up to help.” The people of Gezer were probably Canaanites (1 Kings 9:16), a more distantly related, different tribe from the Amorites of the hill Country. Gezer sits at a strategic sentinel intersection of main routes from the Mediterranean coast up into the hill country. Horam the king of Gezer tried to help the Amorites because he knew that Israel’s successes were a threat to him.
“but Joshua struck him and his people.” There is no record that Joshua and his army went to Gezer to fight it, but Joshua 12:12 says that Joshua did kill the king of Gezer as we see here. It is somewhat of a puzzle that while Joshua struck Gezer’s king and his people, the Israelites did not settle in Gezer until Solomon’s time (1 Kings 9:16). Here, Joshua just kills the men of Gezer who came to help Lachish.