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.
bayhaqi:1819Abū al-Ḥasan ʿAlī b. Muḥammad b. Yūsuf al-Baghdādī al-Raffāʾ > Abū ʿAmr ʿUthmān b. Muḥammad b. Bishr > Ismāʿīl b. Isḥāq > Ismāʿīl b. Abū Ūways > ʿAbd al-Raḥman b. Abū al-Zinād from his father

[Machine] One of our scholars, from the followers of the people of Madinah, said: "If a person loses consciousness and then wakes up during the time of a prayer, they should pray it. Similarly, if they lose consciousness while fasting and then wake up before sunset, they should complete their fast. And if a person loses consciousness and wakes up before sunrise, they should pray Maghrib and Isha. They also said that if a menstruating woman becomes pure before sunset or before sunrise, she should pray the prayers she missed. This ruling is supported by a weakly transmitted Hadith." And Allah knows best.  

البيهقي:١٨١٩أَخْبَرَنَا أَبُو الْحَسَنِ عَلِيُّ بْنُ مُحَمَّدِ بْنِ يُوسُفَ الْبَغْدَادِيُّ الرَّفَّاءُ أنا أَبُو عَمْرٍو عُثْمَانُ بْنُ مُحَمَّدِ بْنِ بِشْرٍ ثنا إِسْمَاعِيلُ بْنُ إِسْحَاقَ ثنا إِسْمَاعِيلُ بْنُ أَبِي أُوَيْسٍ ثنا عَبْدُ الرَّحْمَنِ بْنُ أَبِي الزِّنَادِ أَنَّ أَبَاهُ قَالَ

كَانَ مَنْ أَدْرَكْتُ مِنْ فُقَهَائِنَا الَّذِينَ يُنْتَهَى إِلَى قَوْلِهِمْ يَعْنِي مِنْ تَابِعِي أَهْلِ الْمَدِينَةِ يَقُولُونَ فَذَكَرَ أَحْكَامًا وَفِيهَا الْمُغْمَى عَلَيْهِ لَا يَقْضِي الصَّلَاةَ إِلَّا أَنْ يُفِيقَ وَهُوَ فِي وَقْتِ صَلَاةٍ فَلْيُصَلِّهَا وَهُوَ يَقْضِي الصَّوْمَ وَالَّذِي يُغْمَى عَلَيْهِ فَيُفِيقُ قَبْلَ غُرُوبِ الشَّمْسِ يُصَلِّي الظُّهْرَ وَالْعَصْرَ وَإِنْ أَفَاقَ قَبْلَ طُلُوعِ الْفَجْرِ صَلَّى الْمَغْرِبَ وَالْعِشَاءَ قَالُوا وَكَذَلِكَ تَفْعَلُ الْحَائِضُ إِذَا طَهُرَتْ قَبْلَ غُرُوبِ الشَّمْسِ أَوْ طُلُوعِ الْفَجْرِ وَرُوِيَ فِيهِ حَدِيثٌ مُسْنَدٌ فِي إِسْنَادِهِ ضَعْفٌ وَاللهُ أَعْلَمُ