Exodus 14:1

And the LORD spake unto Moses, saying,

The Lord spoke directly to Moses to give deliberate, exact direction where Israel should encamp before the sea. That direction was for Israel to turn aside into a rocky defile and camp beside the sea. This continued God's leading of Israel by the way of the sea instead of through the land of the Philistines, because the Philistines would have regarded them as fugitives stolen away from their Egyptian masters, opposed their passing, and made war with them until Israel returned to Egypt. In this word God told Moses beforehand that Pharaoh would pursue Israel after letting them go. God chose this encampment so that Israel's deliverance would bring Him honor before Pharaoh and all his host, and by leading Israel in this way He revealed Himself as compassionate as well as a God of judgment.

Obedience to this direction brought Israel into a place that looked disastrous, hemmed in by mountains with the sea ahead and Pharaoh's army pursuing. The people had followed the cloud yet disagreed whether it was a favorable sign or a cause for fear, seeing only danger, defeat, and death and blaming Moses for their peril. Moses gave this direction acting under God's instruction and trusted God's promises that He would provide deliverance. God deliberately led them into that apparent danger to test and strengthen their faith and to deliver them from their enemies.