The Prophet ﷺ said, "No man should stay with a lady in seclusion except in the presence of a Dhu- Muhram." A man stood up and said, "O Messenger of Allah ﷺ! My wife has gone out intending to perform the Hajj and I have been enrolled (in the army) for such-and-such campaign." The Prophet ﷺ said, "Return and perform the Hajj with your wife."
عَنِ النَّبِيِّ ﷺ قَالَ لاَ يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ إِلاَّ مَعَ ذِي مَحْرَمٍ فَقَامَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ امْرَأَتِي خَرَجَتْ حَاجَّةً وَاكْتُتِبْتُ فِي غَزْوَةِ كَذَا وَكَذَا قَالَ ارْجِعْ فَحُجَّ مَعَ امْرَأَتِكَ