(1) باب فضله وبيان من فرض عليه
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.
Reference: Bulugh al-Maram 718
In-book reference: Book 6, Hadith 11
English translation: Book 6, Hadith 737