“threw them into a panic.” Or perhaps, “threw them into confusion.” God often fought for Israel by causing the enemy to panic, be confused, and begin to act in a panicked way such as killing each other or madly running away. This often gave Israel an opportunity to kill them, as we see here in Joshua 10. Yahweh defeated Egypt (Exod. 14:24-25) and the Canaanites (Judg. 4:15) the same way.
“the ascent of Beth-horon...as far as Azekah and as far as Makkedah.” The “ascent of Beth-horon” is a well-known road on a ridge that runs from the hill country of Benjamin down into the Shephelah. A person can travel that ridge without having to go down into valleys, making that road an important and well-traveled one. The retreating Amorites ran down the ridge to their towns into the Shephelah. The descent down the road to Beth-horon leads to the Shephelah, and there the road splits, with one road going toward Azekah, and one going toward Makkedah. Thus the text is telling us that the fleeing enemy was in panic and people were trying to get away or get home and as they got down out of the hill country into more level ground they went different ways, so the fighters of Israel would have had to divide up too, and chase them down.