"And I will give to you." From here we learn that Israel did not inherit the land of Canaan from their fathers except through the merit of circumcision. On this condition was the land given to Abraham — that he be circumcised; and on this condition was it given to Isaac and to Jacob — that they be circumcised. And concerning this matter the Holy One, blessed be He, commanded Joshua to circumcise Israel at the time they came to enter the land, for had they not been circumcised they would not have been able to enter the land.
Why Israel Inherited Canaan Only Through the Merit of Circumcision
Midrash Aggadah, Genesis 17:8
ונתתי לך. מיכן שלא ירשו ישראל את ארץ כנען מאבותיהם אלא בזכות המילה, על מנת כן ניתנה הארץ לאברהם על שימול, ועל מנת כן ניתנה ליצחק וליעקב על שימולו, ועל דבר זה צוה הקב"ה ליהושע לימול את ישראל בעת שבאו ליכנס לארץ שאלמלא לא היו מולין לא היו יכולים להכנס לארץ: