The starting point for this question is the Talmudic principle, stated in Ketubot 110b, that a person should always reside in Eretz Yisrael even in a city whose majority is non-Jewish, and should not reside outside the land even in a city whose majority is Jewish — because one who dwells outside the land is likened to one who has no God. The Gemara grounds this in the verse cited by David, "for they have driven me today from attaching myself to the inheritance of Hashem, saying: go serve other gods" (Rashi on Shmuel I 26:19 notes that one who leaves Eretz Yisrael during the Temple period is as though he worships idolatry). Mishneh Torah, Melachim and Wars 5:12 codifies this principle verbatim, and the Ramban (Hasagot on Sefer HaMitzvot, Positive Commandments 4) holds that dwelling in Eretz Yisrael is a biblical positive commandment binding in every generation, even in exile, which accounts for all the weight the rabbis placed on it.
The Sifrei preserves vivid testimony to how seriously Tannaim treated departure from the land: when Sifrei Devarim 80 recounts that Rabbi Yehudah ben Beteira and his colleagues, while leaving the land, recalled Eretz Yisrael, they wept, tore their garments, and declared that dwelling in Eretz Yisrael is equal in weight to all the commandments of the Torah together — and Rabbi Elazar ben Shammua and Rabbi Yohanan the Sandler, upon being reminded of this, immediately turned back rather than continue to Nisibis. Sefer Charedim, Commandments Dependent on the Land of Israel 1:14 likewise counts residence in Eretz Yisrael as a Torah-level positive commandment, citing both the verse "and you shall possess it and dwell in it" and the rabbinic teaching that one who leaves for the diaspora is to be regarded as an idolater.
The prohibition on leaving is not absolute; the sources define narrow permitted grounds for temporary departure. Mishneh Torah, Melachim and Wars 5:9 rules that one may never leave Eretz Yisrael except to study Torah, to marry, or to rescue property from non-Jews — with an obligation to return — and similarly for commercial purposes; permanent settlement abroad is forbidden unless famine is so severe that a dinar's worth of wheat costs two dinarim. Rambam, Mishneh Torah, Melachim and Wars 5:9–12 elaborates that even the famine exception applies only when one has money yet food is unaffordable, but when food is cheap yet one cannot find income and has lost his last coin, he may go wherever livelihood is available — even so, departing is not the mark of a righteous person.
The famine threshold finds its source in the Talmudic discussion at Bava Batra 91a, where the Sages teach that one may not leave unless two se'a of grain are sold for a sela — double the normal price — and Rabbi Shimon adds that this leniency applies only when one cannot find produce to buy at all; if produce is available for purchase, he may not leave even when the price of a se'a has reached a sela. Rabbi Shimon ben Yochai there derives a warning from the story of Elimelech, Mahlon, and Chilion — great leaders of their generation — who were punished because they left the land, as hinted by the verse "Was this Naomi?" (Ruth 1:1–2 provides the narrative backdrop). Ruth Rabbah 1:4 transmits essentially the same price-threshold ruling in the name of Rabban Shimon ben Gamliel, confirming that Israel may not go abroad even when a se'a costs a shekel if produce can still be obtained.
The Sdei Chemed engages a deeper question underlying all of this: Sdei Chemed, Maarechet Alef 246 reasons from the Smag and the Haggahot Maimoniyyot that the Torah's prohibition against returning to Egypt applies specifically to that route — from Eretz Yisrael to Egypt — but that departure to other lands of the diaspora is not itself a biblical prohibition. The practical implication is that while settling abroad is rabbinically or by way of strong custom forbidden, the biblical layer is narrower than sometimes assumed.
The prohibition on leaving also carries consequences in matrimonial law. Shulchan Arukh, Even HaEzer 75:3–5 rules that a spouse cannot be taken from Eretz Yisrael to the diaspora even from poor lodgings to fine ones, and even from a place whose majority is non-Jewish to one whose majority is Jewish; if the husband proposes to move abroad and the wife refuses, he must divorce her and pay her ketubah. Beit Yosef, Even HaEzer 75:5 adds that the compulsion to ascend to Eretz Yisrael applies only when the journey is free of danger, and that in his day, from the far west to Noa Amon, no compulsion was exercised because of the hazards involved.
Even for one who leaves with permission and intends to return, detailed obligations govern his conduct abroad. Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 31:3 rules that a resident of Eretz Yisrael who goes abroad briefly for commerce or on an institutional mission without a fixed time limit observes Yom Tov Sheni in prayer as a resident of Eretz Yisrael, laying tefillin privately. Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 496:10 adds that such a person visiting abroad for Yom Tov should not be called to the Torah on the second day of Yom Tov of the diaspora, except when it falls on a Monday or Thursday when additional olim are added. By contrast, Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 496:11 holds that institutional emissaries who depart with their households for a year or more must conduct themselves in every respect as full residents of the diaspora, both to be lenient and to be strict, and must observe the second day of Yom Tov completely.
Rav Kook (Mishpat Kohen 147) rules that permanent departure from Eretz Yisrael is forbidden, affirming the Rambam's position that one may leave only for permitted purposes such as Torah study or marriage and must return — underscoring that the leniencies the Rambam enumerated are in each case paired with an obligation to come back, and that settling abroad permanently stands in a category of its own.