20 The men of Ai looked back and saw the smoke of the city rising up into the sky, but they had no chance to escape in any direction; the Israelites who had been fleeing toward the wilderness had turned back against their pursuers.

Read Joshua 8:20 Using Other Translations

And when the men of Ai looked behind them, they saw, and, behold, the smoke of the city ascended up to heaven, and they had no power to flee this way or that way: and the people that fled to the wilderness turned back upon the pursuers.
So when the men of Ai looked back, behold, the smoke of the city went up to heaven, and they had no power to flee this way or that, for the people who fled to the wilderness turned back against the pursuers.
When the men of Ai looked behind them, smoke from the town was filling the sky, and they had nowhere to go. For the Israelites who had fled in the direction of the wilderness now turned on their pursuers.