Bulugh
al-Maram
بلوغ المرام
Hajj
كتاب الحج
Chapter 1: Its virtues and those upon whom Hajj (Pilgrimage) is obligatory
باب فضله وبيان من فرض عليه
Bulugh al-Maram 718
Ibn 'Abbas (RAA) narrated, ‘I heard the Messenger of Allah (ﷺ) saying, “A man must never be alone with a woman unless there is a Mahram with her. A woman also may not travel with anyone except with a Mahram (relative).” A man stood up and asked, ‘O Messenger of Allah! My wife has gone for Hajj while I am enlisted for such and such a battle, what should I do?’ The Messenger of Allah (ﷺ) replied, “Go and join your wife in Hajj." Agreed upon, and the wording is from Muslim.
وَعَنْهُ: سَمِعْتُ رَسُولَ اَللَّهِ - صلى الله عليه وسلم -يَخْطُبُ يَقُولُ: { " لَا يَخْلُوَنَّ رَجُلٌ بِاِمْرَأَةٍ إِلَّا وَمَعَهَا ذُو مَحْرَمٍ, وَلَا تُسَافِرُ اَلْمَرْأَةُ إِلَّا مَعَ ذِي مَحْرَمٍ " فَقَامَ رَجُلٌ, فَقَالَ: يَا رَسُولَ اَللَّهِ, إِنَّ اِمْرَأَتِي خَرَجَتْ حَاجَّةً, وَإِنِّي اِكْتُتِبْتُ فِي غَزْوَةِ كَذَا وَكَذَا, قَالَ: " اِنْطَلِقْ, فَحُجَّ مَعَ اِمْرَأَتِكَ " } مُتَّفَقٌ عَلَيْهِ, وَاللَّفْظُ لِمُسْلِمٍ 1 .