كتاب الحج
15  
The Book of Pilgrimage
(74)
Chapter: A woman travelling with a Mahram for Hajj and other purposes
(74)
باب سَفَرِ الْمَرْأَةِ مَعَ مَحْرَمٍ إِلَى حَجٍّ وَغَيْرِهِ ‏‏
Sahih Muslim 827 d

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.
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، وَعُثْمَانُ بْنُ أَبِي شَيْبَةَ، جَمِيعًا عَنْ جَرِيرٍ، - قَالَ قُتَيْبَةُ حَدَّثَنَا جَرِيرٌ، عَنْ عَبْدِ الْمَلِكِ، - وَهُوَ ابْنُ عُمَيْرٍ - عَنْ قَزَعَةَ، عَنْ أَبِي سَعِيدٍ، قَالَ سَمِعْتُ مِنْهُ، حَدِيثًا فَأَعْجَبَنِي فَقُلْتُ لَهُ أَنْتَ سَمِعْتَ هَذَا، مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ فَأَقُولُ عَلَى رَسُولِ اللَّهِ صلى الله عليه وسلم مَا لَمْ أَسْمَعْ قَالَ سَمِعْتُهُ يَقُولُ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ لاَ تَشُدُّوا الرِّحَالَ إِلاَّ إِلَى ثَلاَثَةِ مَسَاجِدَ مَسْجِدِي هَذَا وَالْمَسْجِدِ الْحَرَامِ وَالْمَسْجِدِ الأَقْصَى ‏"‏ ‏.‏ وَسَمِعْتُهُ يَقُولُ ‏"‏ لاَ تُسَافِرِ الْمَرْأَةُ يَوْمَيْنِ مِنَ الدَّهْرِ إِلاَّ وَمَعَهَا ذُو مَحْرَمٍ مِنْهَا أَوْ زَوْجُهَا ‏"‏ ‏.‏
Reference : Sahih Muslim 827d
In-book reference : Book 15, Hadith 465
USC-MSA web (English) reference : Book 7, Hadith 3099
  (deprecated numbering scheme)