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

I heard Abu Sa'id al-Khudri (Allah be pleased with him) saying: I heard four things from Allah's Messenger (ﷺ) which impressed me and captivated me (and one out of these is this), that he forbade a woman to undertake journey extending over two days but with her husband, or with a Mahram; and he then narrated the rest of the hadith.