The Messenger of Allah ﷺ said, "A woman must not travel for three days unless she is accompanied by a male relative within the prohibited degrees of marriage."
أن رسول الله ﷺ قال: لا تسافر المرأة ثلاثا إلا ومعها ذو محرم.
Bukhari narrated it in the chapters on shortening prayer (1087), and Muslim in Hajj (1338), both through Yahya Qattan, from Ubaydullah (who is Ibn Umar Al-Umari), who said, Nafi told me, from Ibn Umar, with this same wording.