The land was given on condition

The Torah

And if you do not listen to Me, and do not do all these mitzvos… and I will scatter you among the nations, and send the sword after you, and your land will be desolate, and your cities destroyed.
(Leviticus 26:14,33)

And you must keep My laws and My rules, and you must not do any of those abhorrent things, neither the citizen nor the stranger who resides among you; for all those abhorrent things were done by the people who were in the land before you, and the land became defiled. So let not the land spew you out for defiling it, as it spewed out the nation that came before you.
(Leviticus 18:28-30)

When you beget children, and grandchildren, and stay for a long time in the land, and you become corrupted and you make a graven image of anything, and do what is evil in the eyes of The L-rd your G-d, to make Him angry – I call to witness today heaven and earth that you will perish quickly from the land that you are crossing over the Jordan to possess; you will not stay long on it; you shall surely be ruined. And G-d will scatter you among the peoples, and you will be left few in number in the nations where G-d will lead you.
(Deuteronomy 4:25-27)

Take heed to yourselves, lest your hearts be seduced, and you turn away and serve other gods, and bow to them. Then G-d will be angry at you, and He will close up the heavens and there will be no rain, and the earth will not give its produce, and you will perish quickly from upon the good land that G-d gives you.
(Deuteronomy 11:16-17)

But if you do not obey the L-RD your G-d to observe faithfully all His commandments and laws which I enjoin upon you this day, all these curses shall come upon you and take effect
(Deuteronomy 28:15).

G-d will lead you and your king, whom you will appoint over you, to a nation you and your fathers did not know.

You shall be moved off the land which you come to inherit, and G-d will scatter you among all the nations, from one end of the earth to the other.
(Deuteronomy 28:63-64)


And Hashem uprooted them from their land, in anger, wrath and great fury, and He cast them into another land, as they are today.
(Devarim 29:27)

The Midrash

Three things were given to the Jews conditionally: the Land of Israel, the Holy Temple, and the kingdom of the house of David. How do we know that the Land of Israel was given conditionally? For the Torah says, “Take heed, lest your heart turn you away and you go off and worship other gods … and you will be quickly removed from the land.”
(Mechilta Yisro 2)

Rabbi Elchonon Wasserman, Rosh Yeshiva of Baranovitch, Poland (1874-1941)
Our stance on the issue of Eretz Yisroel should be no more or less than what is openly declared in the Torah: “He gave them the lands of nations in order for them to observe His statues.” (Psalms 105:44-45). G-d has provided us with the gift of Eretz Yisroel on a condition – and if we negate that condition – the gift is negated as well.”
(Kovetz Maamarim vol. 1 p. 144)