When Pharaoh let the people go, God didn't lead them by way of the land of the Philistines, even though that was the shorter route. God thought, If the people have to fight and face war, they will run back to Egypt.
References for Exodus 13:17
So God led the people by the roundabout way of the Reed Sea desert. The Israelites went up out of the land of Egypt ready for battle.
References for Exodus 13:18
Moses took with him Joseph's bones just as Joseph had made Israel's sons promise when he said to them, "When God takes care of you, you must carry my bones out of here with you."
They set out from Succoth and camped at Etham on the edge of the desert.
The LORD went in front of them during the day in a column of cloud to guide them and at night in a column of lightning to give them light. This way they could travel during the day and at night.
The column of cloud during the day and the column of lightning at night never left its place in front of the people.