After Pharaoh had let the people go God did not lead them along the road to the land of the Philistines, although that was nearby, for God said, “The people might change their minds if they see war and return to Egypt. So God led the people around by the way of the wilderness to the Sea of Reeds, and Bnei-Yisrael went up out of the land of Egypt armed. Exodus 13:17-18
On the way out of Egypt, God protected Israel from military danger by sending them deep into the Sinai Peninsula. Remember, God originally sent us into Egypt to protect us from the moral danger in the land of Canaan (Genesis 38).
Without going into the “worldly” details, some of Jacob’s family – specifically Jacob’s son Judah – became involved in serious immorality because of his families close proximity to the Canaanites. It became apparent that if Jacob’s sons and their families were to remain faithful to God, they needed to leave Canaan until they were morally and spiritually stronger. So God sent a famine on Canaan and arranged for Joseph to provide a place of refuge for Jacob’s family in Egypt, and kept them there for 400 years, separated from the Egyptians in the corner of the land. “Then Joseph said to his brothers and to his father’s household, “I’ll go up and tell Pharaoh, and say to him, ‘My brothers and my father’s household who were in the land of Canaan have come to me. The men are shepherds, for they’ve been men who handle livestock, who have brought their flocks and cattle and everything that they possess.’ So when Pharaoh calls you and says, ‘What is your occupation?’ you must say, ‘Your servants have been men who handle livestock since the time of our youth until now, both we and our fathers,’ so that you can live in the land of Goshen, because every shepherd is loathsome to the Egyptians.” (Genesis 46:31 – 34)
We must be careful not to be too quick to judge inconvenient circumstances in our life. God may be at work behind the scenes to protect you from something more serious. After all, His ways are not our ways.