Jacob left Israel only after being given a direct order by G-d. Even then he was reluctant to leave, since G-d had foretold to Abraham that He would take his descendants down to Egypt. The Ohr ha-Hayyim comments: Presumably, Abraham would have told his offspring [of this prophecy], as Hazal said; so when Jacob saw that food was available in Egypt…he feared that the exile would begin with him (Genesis 46:3). So when Jacob saw all those events unfolding, he understood that the inevitable Egyptian exile was about to begin. Therefore he was reluctant to leave, until G-d told him: Fear not to go down to Egypt, for I will make you into a great nation there [i.e., My intention is to transform you from a small family into a great nation which will be My emissary to the world]. I will go down to Egypt with you, and I will also surely bring you up (Genesis 46:3-4).
That is to say, Jacob was permitted to leave Israel solely because G-d Himself commanded him to do so for a specific and defined purpose. And even then, G-d told him that when the mission would be accomplished, his descendants would return to Israel, since their descent to Egypt was solely for the purpose of their subsequent ascent to the land of Israel.
As we already said, Jacob feared to leave Israel, and the author of the Pesah Haggadah portrayed him as having been compelled by the [Divine] decree. Hazal said: When Jacob heard that Joseph was alive, he thought to himself: How can I leave the land of my fathers, the land of my birth, the land wherein G-d’s Shekhinah is, and go to an impure land? (Pirkei de-Rabbi Eliezer 39). G-d had to reassure him: Do not fear to go down to Egypt – fear neither the descent from the Land of Israel, nor the descent to impurity – for I will make you into a great nation there – for My intention is to make you a great and exalted nation, which can happen only there. I will go down with you to Egypt – I am going down with you, to guarantee that this descent will be directed as I want it to be – and I will assuredly bring you up from there – I guarantee that there will be two ascents: a physical ascent in returning to the Land of Israel, and a spiritual ascent, as I have already planned. It must again be emphasized that Jacob’s descent to Egypt was an exceptional event, specifically according to G-d’s decree, in order that the nation would be born in Kiddush HASHEM. Therefore, the Midrash says: It was appropriate for our father Jacob to go down to Egypt even in manacles (Genesis Rabbah 86:2) – he had to go down there, even against his will. Therefore, the Torah describes Jacob’s family as coming to Egypt, rather than as going down to Egypt, which would have been expected. The prophet, for example, says that they would go down to Egypt for help (Isaiah 31:1). Sa’adya Gaon explains that, as a rule, anyone who leaves the Land of Israel descends spiritually into impurity; but in this specific instance, there was a unique aim of forging a nation in the iron furnace. Therefore, this particular journey to Egypt did not constitute a descent, and G-d therefore permitted the Children of Israel to leave the Land of Israel. [...]
The central principle here is that leaving the Land of Israel was justified only as an intrinsic part of the crucial process of creating a nation which would return to Israel afterwards as a chosen nation living in a chosen land, building a holy society in a holy state.
The descent was solely for the purpose of the subsequent ascent, for the purpose of returning to Israel. [...] when they came to Egypt they were few in number, and by the grace of G-d they multiplied greatly, until they became a large nation. The Rashbam comments: When they reached Egypt, they were no more than seventy, and after the death of that generation, they were fruitful and swarmed. He [Jacob] went down to Egypt according to the divine plan and command, which G-d had already explained to Abraham in the Covenant between the Parts:Know for a surety that your seed will be strangers in a land not theirs, and they will serve them, and they will oppress them for four hundred years (Genesis 15:13). So the Torah enumerates them all, showing that at that time, all were equal to Jacob, all came to Egypt to dwell temporarily, not in order to settle down there. The Midrash expresses this by saying, They were all comparable to Jacob, for all were tzaddikim (Exodus Rabbah 1:1). This is also what Rashi means by commenting: Even though they were enumerated by name during their lifetimes [in Genesis 46:8], they were enumerated once again after their deaths to show [G-d’s] love for them. They were likened to the stars, which G-d leads and enumerates by name, as it says, 'He brings forth their legions by number, He calls each one by name' (Isaiah 40:26). This follows the Midrashic statement that Israel are equivalent to the heavenly legions (Exodus Rabbah 1:3). G-d told Abraham: Look now to the heavens and count the stars … thus shall your seed be (Genesis 15:5) – that is to say, your seed will be like the stars, like the heavenly legions. I have chosen you to be My emissaries, to bring knowledge of HASHEM to the world and to sanctify My Name, to make known that I am omnipotent, the true LORD. Indeed, G-d is sanctified with the appellation G-d of Legions, in the verse Holy, holy, holy, in HASHEM, LORD of Legions (Isaiah 6:3). Moreover, the two words Legions and holy are interconnected: our Redeemer, HASHEM, LORD of Legions is His Name, the Holy One of Israel (Isaiah 47:4). For when it becomes clear that the greatest and mightiest legions in heaven and on earth, including the stars which are infinite in their extent and number, are all the works of G-d, that he controls them and supervises them individually – then He is indeed aggrandized and sanctified. So these heavenly legions indeed “tell of G-d’s glory”– their very existence testifies to His glory. And in just the same way, the nation of Israel was chosen for the same task, and are therefore compared to the stars. Clearly, when they fulfill their role, when they are righteous like Jacob, G-d bestows His love upon them, deriving satisfaction from them and enumerating them all singly, like a father who continuously counts his children and ensures that none are missing. The moral here is that the Torah teaches G-d’s intention in bringing the Children of Israel down to Egypt, and simultaneously makes it clear that they were all tzaddikim, and went down there solely for G-d’s purpose, with no thoughts of abandoning the Land of Israel permanently. [...]
But in any event, the Israelites’ regression that would begin after the death of Jacob and his sons was already hinted at in the Book of Genesis: And Israel dwelt in the land of Egypt, in the land of Goshen, and they seized it, and they were fruitful and multiplied greatly (Genesis 47:27). The Kli Yakar comments: This entire verse levels an accusation at the Children of Israel. For G-d decreed that “your seed will be a stranger” (Genesis 15:13), but they sought to be permanent residents.…So firmly entrenched did they become there that they did not want to leave Egypt, to the extent that G-d had to bring them out with a mighty hand; and those who did not want to leave, died in the three days of the darkness. Know that the first exile and redemption are the paradigm for the final exile and redemption. Just as in that first redemption, G-d put an end to the exile against the Jews’ will, and those who stubbornly persisted in remaining there perished, so too will be – G-d forbid! – in this final redemption of our era, whose first stages we are living through now. For G-d will not suffer the contempt for His treasured Land and the continuation of the exile, which epitomizes chillul HASHEM and impurity, simultaneously with the rise of a Jewish state in the Land of Israel, which epitomizes Kiddush HASHEM and purity. [...] G-d does not want us to dwell exile, and will not allow us to. Even if generations may have passed and Jews have lived comfortably in any given country, the day of reckoning will yet come. And the Jew must therefore understand that exile, with all its implications, begins the moment that he finds himself on foreign soil, in a land not his own, regardless of how good his conditions may be at that particular moment. In his Introduction to the Book of Exodus, the Ramban writes: Their descent [to Egypt] was the start of the exile, for then it began. And the exile was completed only on the day when they returned to their place … and when they left Egypt, even though they had left the House of Slavery, they were still exiles, for they were still not in their own land, wandering through the wilderness. The lesson is clear: even had they been emancipated but remained in Egypt, they would still have been in exile.