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:8703Abū Saʿīd Muḥammad b. Mūsá b. al-Faḍl > Abū al-ʿAbbās Muḥammad b. Yaʿqūb > al-Rabīʿ b. Sulaymān > al-Shāfiʿī

[Machine] The obligation of Hajj was revealed to the Prophet ﷺ after his migration, and the Messenger of Allah ﷺ opened Mecca in the month of Ramadan and left it in Shawwal. At that time, he appointed 'Attab ibn Asid as its governor. He established the Hajj for the Muslims by the order of the Messenger of Allah ﷺ. The Messenger of Allah ﷺ was in Medina and was capable of performing Hajj along with his wives and most of his companions.

Later, the Messenger of Allah ﷺ left for Tabuk and sent Abu Bakr to lead the Hajj for the people in the ninth year. The Messenger of Allah ﷺ was still in Medina and was capable of performing Hajj, but he did not perform it, nor did his wives or any of his companions until he performed it in the tenth year.

Based on this, we deduced that performing Hajj is obligatory once in a lifetime, with the condition of reaching puberty, and it should be done before death. The Sheikh (scholar) mentioned that this is also mentioned in the reports and historical accounts.

As for the mention of the revelation of the obligation of Hajj after migration, as the Shafi'i scholars have mentioned, our companions have derived it from the Hadith of Ka'b ibn 'Ujrah, indicating that it was revealed during the time of Hudaybiyah.  

البيهقي:٨٧٠٣أَخْبَرَنَا أَبُو سَعِيدٍ مُحَمَّدُ بْنُ مُوسَى بْنِ الْفَضْلِ ثنا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ أنبأ الرَّبِيعُ بْنُ سُلَيْمَانَ أنبأ الشَّافِعِيُّ قَالَ

نَزَلَتْ فَرِيضَةُ الْحَجِّ عَلَى النَّبِيِّ ﷺ بَعْدَ الْهِجْرَةِ وَافْتَتَحَ رَسُولُ اللهِ ﷺ مَكَّةَ فِي شَهْرِ رَمَضَانَ وَانْصَرَفَ عَنْهَا فِي شَوَّالٍ وَاسْتُخْلِفَ عَلَيْهَا عَتَّابُ بْنُ أَسِيدٍ فَأَقَامَ الْحَجَّ لِلْمُسْلِمِينَ بِأَمْرِ رَسُولِ اللهِ ﷺ وَرَسُولُ اللهِ ﷺ بِالْمَدِينَةِ قَادِرٌ عَلَى أَنْ يَحُجَّ وَأَزْوَاجُهُ وَعَامَّةُ أَصْحَابِهِ ثُمَّ انْصَرَفَ رَسُولُ اللهِ ﷺ عَنْ تَبُوكَ فَبَعَثَ أَبَا بَكْرٍ فَأَقَامَ الْحَجَّ لِلنَّاسِ سَنَةَ تِسْعٍ وَرَسُولُ اللهِ ﷺ بِالْمَدِينَةِ قَادِرٌ عَلَى أَنْ يَحُجَّ لَمْ يَحُجَّ هُوَ وَلَا أَزْوَاجُهُ وَلَا أَحَدٌ مِنْ أَصْحَابِهِ حَتَّى حَجَّ سَنَةَ عَشْرٍ فَاسْتَدْلَلْنَا عَلَى أَنَّ الْحَجَّ فَرْضُهُ مَرَّةٌ فِي الْعُمُرِ أَوَّلُهُ الْبُلُوغُ وَآخِرُهُ أَنْ يَأْتِيَ بِهِ قَبْلَ مَوْتِهِ قَالَ الشَّيْخُ وَهَذَا الَّذِي ذَكَرَهُ الشَّافِعِيُّ رَحِمَهُ اللهُ مَوْجُودٌ فِي الْأَخْبَارِ وَالتَّوَارِيخِ أَمَّا مَا ذَكَرَهُ مِنْ نُزُولِ فَرِيضَةِ الْحَجِّ بَعْدَ الْهِجْرَةِ فَكَمَا قَالَ وَاسْتَدَلَّ أَصْحَابُنَا بِحَدِيثِ كَعْبِ بْنِ عُجْرَةَ عَلَى أَنَّهَا نَزَلَتْ زَمَنَ الْحُدَيْبِيَةِ