(Numbers 13:25:) "And they returned from spying out the land at the end of forty days." But behold, you find that they went from the south to the north, and in forty days they were able to traverse the whole of it. Rather, it was revealed before the Holy One, blessed be He, that they would come and speak slander, and that there would be decreed against that generation years of trouble (as it is said in Numbers 14:34:) "A day for a year, a day for a year, you shall bear your iniquities, forty years." And the Holy One, blessed be He, leapt the road before them.
How God Shortened the Spies' Road in Forty Days
Midrash Tanchuma Buber, Sh'lach 15:2
וישובו מתור הארץ מקץ ארבעים יום (במדבר יג כה), והלא אתה מוצא שהלכו מן הדרום לצפון, ולארבעים יום היו מהלכין את כולה, אלא גלוי היה לפני הקב"ה שהן באין ואומרין לשון הרע, ונגזר על אותו הדור שנים של צרה, יום לשנה [יום לשנה] תשאו את עונותיכם ארבעים שנה (שם יד לד), וקיפץ הקב"ה לפניהם את הדרך.