In Numbers 33:5-8 we read of the route taken by Israel when existing Egypt: And the children of Israel removed from Rameses, and pitched in Succoth. And they departed from Succoth, and pitched in Etham, which is in the edge of the wilderness. And they removed from Etham, and turned again unto Pihahiroth, which is before Baalzephon: and they pitched before Migdol. And they departed from before Pihahiroth, and passed through the midst of the sea into the wilderness, and went three days’ journey in the wilderness of Etham, and pitched in Marah.
The record in the book of Exodus is equally clear about this 180˚ turn around and also gives us the reason for it taking place, cf. Exodus 14:1-4: And the LORD spake unto Moses, saying, Speak unto the children of Israel, that they turn and encamp before Pihahiroth, between Migdol and the sea, over against Baalzephon: before it shall ye encamp by the sea. For Pharaoh will say of the children of Israel, They are entangled in the land, the wilderness hath shut them in. And I will harden Pharaoh’s heart, that he shall follow after them; and I will be honoured upon Pharaoh, and upon all his host; that the Egyptians may know that I am the LORD. And they did so.