The Israelites left Egypt and then God tells Moses to turn back and camp by the sea.
“דַּבֵּר, אֶל-בְּנֵי יִשְׂרָאֵל, וְיָשֻׁבוּ וְיַחֲנוּ לִפְנֵי פִּי הַחִירֹת, בֵּין מִגְדֹּל וּבֵין הַיָּם: לִפְנֵי בַּעַל צְפֹן, נִכְחוֹ תַחֲנוּ עַל-הַיָּם”
“Tell the sons of Israel to turn back and camp before Pi-hahiroth, between Migdol and the sea; you shall camp in front of Baal-zephon, opposite it, by the sea.”
God revealed the location of the israelites to the magicians of Pharaoh. They assumed that the Israelites are trapped in the desert and can not cross the sea. Pharaoh decided to go after them and bring them back, not knowing that this is a planned trap to destroy him and his kingdom conmpletly.
“ וַיֻּגַּד לְמֶלֶךְ מִצְרַיִם, כִּי בָרַח הָעָם; וַיֵּהָפֵךְ לְבַב פַּרְעֹה וַעֲבָדָיו, אֶל-הָעָם, וַיֹּאמְרוּ מַה-זֹּאת עָשִׂינוּ, כִּי-שִׁלַּחְנוּ אֶת-יִשְׂרָאֵל מֵעָבְדֵנוּ”
“When the king of Egypt was told that the people had fled, Pharaoh and his servants had a change of heart toward the people, and they said, “What is this we have done, that we have let Israel go from serving us?””
Going against the negative side should a total annihilation war. The killing of the first born disconnect the negative side from their spiritual roots. Leaving their armies behind is like letting them have opportunity to recover and grow again.
When we work on ourselves to remove negative and impure aspects from our lives we should go all the way, including removing ourselves from negative influence of people and the environment. If we don’t change and move the negative side will come to take away the little freedom we earned and enslave us again. The move doesn’t have to be a physical relocation but a social change.