Language:
كتاب الجهاد والسير
56  
Fighting for the Cause of Allah (Jihaad)
(140)
Chapter: If a man has enlisted himself in the army and then his wife goes out for Hajj
(140)
باب مَنِ اكْتُتِبَ فِي جَيْشٍ فَخَرَجَتِ امْرَأَتُهُ حَاجَّةً وَكَانَ لَهُ عُذْرٌ هَلْ يُؤْذَنُ لَهُ
Sahih al-Bukhari 3006

Narrated Ibn `Abbas:

That he heard the Prophet (ﷺ) saying, "It is not permissible for a man to be alone with a woman, and no lady should travel except with a Muhram (i.e. her husband or a person whom she cannot marry in any case for ever; e.g. her father, brother, etc.)." Then a man got up and said, "O Allah's Messenger (ﷺ)! I have enlisted in the army for such-and-such Ghazwa and my wife is proceeding for Hajj." Allah's Messenger (ﷺ) said, "Go, and perform the Hajj with your wife."

حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا سُفْيَانُ، عَنْ عَمْرٍو، عَنْ أَبِي مَعْبَدٍ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ أَنَّهُ سَمِعَ النَّبِيَّ صلى الله عليه وسلم يَقُولُ ‏"‏ لاَ يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ، وَلاَ تُسَافِرَنَّ امْرَأَةٌ إِلاَّ وَمَعَهَا مَحْرَمٌ ‏"‏‏.‏ فَقَامَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ، اكْتُتِبْتُ فِي غَزْوَةِ كَذَا وَكَذَا، وَخَرَجَتِ امْرَأَتِي حَاجَّةً‏.‏ قَالَ ‏"‏ اذْهَبْ فَحُجَّ مَعَ امْرَأَتِكَ ‏"‏‏.‏
Reference : Sahih al-Bukhari 3006
In-book reference : Book 56, Hadith 215
USC-MSA web (English) reference : Vol. 4, Book 52, Hadith 250
  (deprecated numbering scheme)