During the journey on which the Messenger of Allah ﷺ and his companions slept until the sun had risen, he said, "You were as dead, and Allah returned your souls to you. Whoever sleeps through a prayer should perform it when he wakes, and whoever forgets a prayer should perform it when he remembers."
كان رسول الله ﷺ في سفره الذي ناموا فيه حتى طلعت الشمس فقال: إنكم كنتم أمواتا، فرد الله إليكم أرواحكم، فمن نام عن صلاة فليصلها إذا استيقظ، ومن نسي صلاة فليصل إذا ذكر.
Abu Yaala narrated it in Maqsad Ali (203) from Abu Khaythama, who said, Fadl bin Dukayn narrated to us, who said, Abdul-Jabbar bin Abbas Hamdani narrated to us, from Awn bin Abu Juhayfa, from his father, and he mentioned something similar.Its isnad is hasan because of Abdul-Jabbar bin Abbas Hamdani Shibami, who has been criticized regarding his memory, though he is hasan in hadith. Haythami said in Majma (1803), "Abu Yaala and Tabarani narrated it in Kabir, and its narrators are trustworthy."On this subject there is also a narration from Abu Saeed Khudri, narrated by Abu Yaala in Maqsad Ali (204), but it contains Hasan, who conceals his sources, and he transmitted it using the ambiguous form "an."There is also a narration from Abdullah bin Masud concerning the story of the Prophet's ﷺ stopping to rest. Ahmad narrated it (3710), as did Abu Yaala in Maqsad Ali (202), but it contains Abdul-Rahman bin Abdullah Masudi, whose memory became confused, and the one who transmitted from him, Abdul-Rahman bin Mahdi, narrated from him after this confusion had set in. It also contains an objectionable element, namely that the guard in this story is said to be Abdullah bin Masud himself, whereas the correct account is that it was Bilal, as found in Sahih Muslim and elsewhere.There is also a narration from Samura bin Jundab, narrated by Bazzar in Kashf Astar (397), but it contains Yusuf bin Khalid Samti, who is a liar, as Haythami said. Ahmad also narrated it (20257), as did Tabarani, but it contains Bishr bin Harb Azdi, whom Ahmad, Abu Dawud, Ibn Saad, Ajli, and others graded daif.The hadiths on this subject provide evidence that if a missed prayer is remembered during a time when prayer is prohibited, it should be prayed without delay, and this is the view of Shafii, Ahmad, and Ishaq. The people of Kufa said, "Whoever sleeps through Asr and wakes up at sunset should not pray until the sun has set. Likewise, whoever wakes up at sunrise should not pray until the sun has fully risen."See Tirmidhi's comments on the hadith of Abu Qatada (177) and the hadith of Anas (178).