17 When Pharaoh finally let the people go, God did not lead them along the main road that runs through Philistine territory, even though that was the shortest route to the Promised Land. God said, "If the people are faced with a battle, they might change their minds and return to Egypt." 18 So God led them in a roundabout way through the wilderness toward the Red Sea. Thus the Israelites left Egypt like an army ready for battle.
Matthew Henry's Commentary on Exodus 13:17-18
Commentary on Exodus 13:17-20
(Read Exodus 13:17-20)
There were two ways from Egypt to Canaan. One was only a few days' journey; the other was much further about, through the wilderness, and that was the way in which God chose to lead his people Israel. The Egyptians were to be drowned in the Red sea; the Israelites were to be humbled and proved in the wilderness. God's way is the right way, though it seems about. If we think he leads not his people the nearest way, yet we may be sure he leads them the best way, and so it will appear when we come to our journey's end. The Philistines were powerful enemies; it was needful that the Israelites should be prepared for the wars of Canaan, by passing through the difficulties of the wilderness. Thus God proportions his people's trials to their strength, 1 Corinthians 10:13. They went up in good order. They went up in five in a rank, some; in five bands, so others, which it seems rather to their faith and hope, that God would bring them to Canaan, in expectation of which they carried these bones with them while in the desert.