The Ohr Hachaim and Sforno explain based on the Gemara in Ta’anit (29a) which comments on the pasuk, “The people wept that night” (Bamidbar 14:1): Hashem said to them, “You cried for naught; I will establish a crying for all generations.” That day was Tisha B’Av, on which the first and second Temples were destroyed.
Furthermore, Chazal say that had Moshe entered the land, the Temple would not have been destroyed, as no nation would have been able to touch it. On the pasuk, “A psalm of Asaph: O G-d! The nations have entered into Your inheritance,” Chazal say (Midrash Tehillim 79): “A psalm of Asaph?!” It should have said, “A lamentation,” since they destroyed the Temple! Rather, it is called a psalm because G-d expended His wrath on the wood and stones of the Temple, while Israel survived.
Thus, had Moshe entered Eretz Yisrael, the Temple would not have been destroyed, and hence, Heaven forbid, G-d would have expended his wrath on Israel instead, leaving no remnant of them. Therefore, it worked out that the decree was issued that Moshe should not enter the Land, so that the Temple could be destroyed, and Israel was saved.
However, were it not for the sin of the spies, Israel would certainly have remained righteous, and the forces of evil would not have prevailed. We would never have reached the point at which to weigh the destruction of Israel or the destruction of the Temple. However, after the sin of the spies, G-d foresaw that the hand of the wicked would prevail, and there was a need to allow the destruction of the Temple. Therefore, it was necessary that Moshe not enter the Land, to allow saving Israel by destroying the Temple.
What was the cause for this crying for all generations? The Sforno comments on the pasuk, “Hashem heard the sound of your words” (Devarim 1:34): “The sound of crying for naught.” It is possible that the spies, and Bnei Yisrael in their wake, spoke logically; that there was merit to their arguments. However, a lot depends on the tone in which the words are said, on what is implied by them. Hashem listened to “the sound of your words” — not only to the claim itself. He listened to the tone and heard the sound of crying for naught; for this came the decree.
This bears a lesson for our generation. There are those who see in our current political situation a problem of security or of saving lives. There are those who see an injustice to another nation. We, based on our world outlook, reject outright claims of this sort, since in our opinion they are insufficient to weaken our right to Eretz Yisrael, which was given to us with a covenant and oath by the Creator of the world. Still, these are claims that are understandable. But what is the meaning of the rejoicing on every concession and every piece of land which is ripped away from Eretz Yisrael? Here we already hear the tone which is behind the logic, and the tone is very worrying. Heaven forbid that it should be said about us, “From a distance shall you see the Land, but you shall not enter there.” (Devarim 32:52)
During the period of the three weeks we must deal with issues of Eretz Yisrael, to strengthen our love of it, in order to rectify the crying for naught, as opposed to, “They despised the desirable land.” (Tehillim 106:24)