[(Numbers 13:2:) "Send for yourself men."] This is what Scripture says (Isaiah 44:18): "They do not know, nor do they understand; (they walk in darkness;) for their eyes are too plastered over to see." What did [Scripture] see to say "Send for yourself" right after the affair of Miriam? Only that it was foreseen before the Holy One, blessed be He, that they would come and speak slander against the Land. The Holy One, blessed be He, said: Let them not say, "We did not know what the punishment of slander is." Therefore He set this matter next to that one. And because Miriam spoke against her brother, she was stricken with leprosy, so that all should know the punishment of slander, as it is said (Numbers 12:16): "And afterward the people journeyed from Hazeroth and encamped in the wilderness of Paran" — so that if they came to speak slander, they would look upon the affair of Miriam. Yet even so they did not wish to learn. Therefore it is said, "They do not know, nor do they understand." Therefore the Holy One, blessed be He, wrote the sending of the spies after the affair of Miriam.
Why the Spies Follow Miriam's Leprosy in the Torah
Midrash Tanchuma Buber, Sh'lach 6:1
[שלח לך אנשים]. זש"ה לא ידעו ולא יבינו (בחשיכה יתהלכו) כי טח מראות עיניהם (ישעיה מד יח), מה ראה לומר אחר מעשה מרים, שלח לך, אלא שהיה צפוי לפני הקב"ה שהם באין ואומרין לשון הרע על הארץ, אמר הקב"ה שלא יאמרו לא היינו יודעין עונשו של לשון הרע מהו, לפיכך סמך את הענין [זה] לזה, ולפי שדיברה מרים באהיה, לקתה בצרעת, כדי שיהו הכל יודעין עונשו של לשון הרע, שנאמר ואחר נסעו העם מחצרות ויחנו במדבר פארן (במדבר יב טז), שאם באו לומר לשון הרע יהיו מסתכלין במעשה מרים, ואעפ"כ לא רצו ללמד, לכך נאמר לא ידעו ולא יבינו, לכך כתב הקב"ה שילוח מרגלים, אחר מעשה מרים.