The Prophet ﷺ said, "A woman must not travel for three days unless accompanied by a close male relative."
حدثنا أحمد بن حنبل حدثنا يحيى بن سعيد عن عبيد الله قال حدثني نافع
عن النبي ﷺ قال لا تسافر المرأة ثلاثا إلا ومعها ذو محرم
Bukhari narrated it in the chapter on shortening prayer, "In how many [miles/days] is prayer shortened?", no. 1087, and Muslim in the Hajj chapter, no. 1338, from the hadith of Yahya bin Saeed Qattan, with the same wording.