حَدَّثَنَا زُهَيْرُ بْنُ حَرْبٍ، وَمُحَمَّدُ بْنُ الْمُثَنَّى، قَالاَ حَدَّثَنَا يَحْيَى، - وَهُوَ الْقَطَّانُ - عَنْ عُبَيْدِ اللَّهِ، أَخْبَرَنِي نَافِعٌ، عَنِ ابْنِ عُمَرَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ لاَ تُسَافِرِ الْمَرْأَةُ ثَلاَثًا إِلاَّ وَمَعَهَا ذُو مَحْرَمٍ ‏"‏ ‏.‏
Translation
Qaza'ah reported

I heard a hadith from Abu Sa'id (Allah be pleased with him) and it impressed me (very much), so I said to him: Did you hear it (yourself) from Allah's Messenger (ﷺ)? Thereupon he said: (Can) I speak of anything about Allah's Messenger (ﷺ) which I did not bear? He said: I heard Allah's Messenger (ﷺ) saying: Do not set out on a journey (for religious devotion) but for the three mosques-for this mosque of mine (at Medina) the Sacred Mosque (at Mecca), and the Mosque al-Aqsa (Bait al-Maqdis), and I heard him saying also: A woman should not travel for two days duration, but only when there is a Mahram with her or her husband.