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 Messenger of Allah ﷺ! I have enlisted in the army for such-and-such Ghazwa and my wife is proceeding for Hajj." Messenger of Allah ﷺ said, "Go, and perform the Hajj with your wife."
أَنَّهُ سَمِعَ النَّبِيَّ ﷺ يَقُولُ لاَ يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ وَلاَ تُسَافِرَنَّ امْرَأَةٌ إِلاَّ وَمَعَهَا مَحْرَمٌ فَقَامَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ اكْتُتِبْتُ فِي غَزْوَةِ كَذَا وَكَذَا وَخَرَجَتِ امْرَأَتِي حَاجَّةً قَالَ اذْهَبْ فَحُجَّ مَعَ امْرَأَتِكَ