Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:5:26

˹Allah˺ said, "Then indeed, it is forbidden to them for forty years ˹in which˺ they will wander throughout the land. So do not grieve over the defiantly disobedient people."  

He, God, exalted be He, said, to him: ‘Then it, the Holy Land, shall be forbidden them, to enter, for forty years; they shall wander lost, bewildered, in the land — according to Ibn ‘Abbās this ˹land˺ was about nine parasangs ˹sc. 30 miles˺; so do not grieve for the wicked folk’. It is reported that they would travel throughout the night earnestly, but in the morning would find themselves back where they had started. And they would travel all day, with the same result, until they all perished, except those under twenty years of age. It is said that they numbered 600,000. Moses and Aaron died in the wilderness, and this was a mercy for them, and a chastisement for those others. When Moses was on the verge of death, he asked his Lord to bring him close to the Holy Land, to within a stone’s throw, and He did, as related in hadīth. Joshua became a prophet sometime after his fortieth year and he was commanded to fight against the giants. So he sallied forth with those that remained by his side and he fought against them; it was a Friday and the sun stopped for him for an hour, until he had finished with fighting them. Ahmad ˹b. Hanbal˺ reported in his Musnad the ˹following˺ hadīth, ‘The sun was never detained for any human, except for Joshua during those days in which he marched towards the Holy House ˹of Jerusalem˺’.
القرآن:٥:٢٦

قَالَ فَإِنَّهَا مُحَرَّمَةٌ عَلَيْهِمْ ۛ أَرْبَعِينَ سَنَةً ۛ يَتِيهُونَ فِي الْأَرْضِ ۚ فَلَا تَأْسَ عَلَى الْقَوْمِ الْفَاسِقِينَ  

(قال) تعالى له (فإنها) أي الأرض المقدسة (محرمة عليهم) أن يدخلوها (أربعين سنة يتيهون) يتحيرون (في الأرض) وهي تسعة فراسخ قاله ابن عباس (فلا تأس) تحزن (على القوم الفاسقين) روي أنهم كانوا يسيرون الليل جادين فإذا أصبحوا إذا هم في الموضع الذي ابتدأوا منه ويسيرون النهار كذلك حتى انقرضوا كلهم إلا من لم يبلغ العشرين، قيل: وكانوا ستمائة ألف ومات هارون وموسى في التيه وكان رحمة لهما وعذابا لأولئك وسأل موسى ربه عند موته أن يدنيه من الأرض المقدسة رمية بحجر فأدناه كما في الحديث، ونبئ يوشع بعد الأربعين وأمر بقتال الجبارين فسار بمن بقي معه وقاتلهم وكان يوم الجمعة ووقفت له الشمس ساعة حتى فرغ من قتالهم، وروى أحمد في مسنده حديث "" إن الشمس لم تحبس على بشر إلا ليوشع ليالي سار إلى بيت المقدس "".