As Benei Yisrael stood trapped against the sea by the pursuing Egyptian army, Moshe urged them not to be frightened, “because the way you see the Egyptians today – you will never again see them” (14:13). Indeed, the waters of the sea split, allowing Benei Yisrael to pass through peacefully, before crashing down on and drowning the Egyptians.
The Mekhilta, commenting on the aforementioned verse, writes that this marks one of the three instances when the Torah issues a prohibition against going to Egypt. The other two are “and the Lord said: You shall not again return there” (Devarim 17:16) and “The Lord shall bring you back to Egypt in boats, along the way which I have told you that you shall never see again” (Devarim 28:68).
This halakha is mentioned in the Talmud, as well. The Gemara in Masekhet Sukka (51b) comments that the ancient Jewish community in Alexandria was in violation of the prohibition issued in Parashat Shoftim, “You shall not again return there.” Interestingly, the Gemara mentions only that verse, without citing the verse in Parashat Beshalach (or the verse from the end of Sefer Devarim) mentioned by the Mekhilta. This is in contrast to the parallel passage in the Talmud Yerushalmi (there in Masekhet Sukka), which comments that the Jews of Alexandria violated all three prohibitions mentioned by the Mekhilta.
This point was observed by the Maharitz Chayot, in his notes to Masekhet Sukka. He writes that the Talmud Bavli likely disagrees with the Mekhilta and Yerushalmi, and maintains that the only source for this prohibition is the verse in Parashat Shoftim. Moshe’s statement in Parashat Beshalach was made before Matan Torah, and therefore, in the view of the Bavli, it cannot serve as a source for a halakhic prohibition. To this we might add that the simple meaning of Moshe’s statement is that he reassures the people that they would never have to see their former oppressors, not that there is a halakhic prohibition to do so. For this reason, too, perhaps, the Bavli did not cite this verse as a source.
This discussion may likely yield practical implications. The Sefer Yerei’im (309) writes that the prohibition against returning to Egypt applies only to traveling to Egypt from Eretz Yisrael. Moving to Egypt from other locations, however, does not violate this law. The Yerei’im advanced this theory as a possible basis for explaining why many Torah observant Jews lived in Egypt. Already the Radbaz (Hilkhot Melakhim 5:7) raised the question of how to reconcile the Yerei’im’s theory with the Mekhilta, which cites as one of the sources of this prohibition Moshe’s remarks to Benei Yisrael at the shore of the Yam Suf. Benei Yisrael at that time stood not in Eretz Yisrael, but at the Yam Suf, and Moshe informed them that it was forbidden to return to Egypt. If, indeed, this is a source for the prohibition against moving to Egypt, it becomes very difficult to accept the Yerei’im’s contention that traveling to Egypt from places other than the Land of Israel is permissible. Evidently, the Yerei’im maintained that the Talmud Bavli did not accept the Mekhilta’s view, and did not view this verse in Parashat Beshalach as a source for the halakhic prohibition against moving to Egypt. According to the Bavli, the only source is the verse in Sefer Devarim which speaks of moving from Eretz Yisrael to Egypt, and thus the Yerei’im concluded that the prohibition is limited to this particular route.
(Based on Rav Chaim Leib Eisenstein’s Peninim Mi-bei Midresha, Parashat Beshalach)