Bulugh al-Maram, Book 6, Hadith 737 (English)

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‏.‏ ‏1 ‏- صحيح.‏ رواه البخاري ( 1862 )‏، ومسلم ( 1341 )‏، وانظر الدليل الأول من رسالتي: " أوضح البيان في حكم سفر النسوان ".‏

sunnah.com

also referenced under: Book 6, Hadith 11 (In-Book)