كتاب الصيام
13  
The Book of Fasting
(15)
Chapter: It is permissible to fast or not to fast during Ramadan for one who is travelling for no sinful purpose, if his journey is two stages or further. But it is better for the one who is able to fast without suffering any harm to do so, and the one for whom it is difficult may break the fast
(15)
باب جواز الصوم والفطر في شهر رمضان للمسافر في غير معصية إذا كان سفره مرحلتين فأكثر وأن الأفضل لمن أطاقه بلا ضرر أن يصوم ولمن يشق عليه أن يفطر
Sahih Muslim 1113 e

Ibn 'Abbas (Allah be pleased with him) reported that the Messenger of Allah (ﷺ) journeyed during the month of Ramadan in a state of fasting till he reached 'Usfan. He then ordered a cup containing drinking water and he drank that openly so that the people might see it, and broke the fast (and did not resume it) till he reached Mecca. Ibn 'Abbas (Allah be pleased with him) said:

Allah's Messenger (ﷺ) fasted and broke the fast, so he who wished fasted and he who wished to break it broke it.
وَحَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ، أَخْبَرَنَا جَرِيرٌ، عَنْ مَنْصُورٍ، عَنْ مُجَاهِدٍ، عَنْ طَاوُسٍ، عَنِ ابْنِ عَبَّاسٍ، - رضى الله عنهما - قَالَ سَافَرَ رَسُولُ اللَّهِ صلى الله عليه وسلم فِي رَمَضَانَ فَصَامَ حَتَّى بَلَغَ عُسْفَانَ ثُمَّ دَعَا بِإِنَاءٍ فِيهِ شَرَابٌ فَشَرِبَهُ نَهَارًا لِيَرَاهُ النَّاسُ ثُمَّ أَفْطَرَ حَتَّى دَخَلَ مَكَّةَ ‏.‏ قَالَ ابْنُ عَبَّاسٍ - رضى الله عنهما - فَصَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَأَفْطَرَ فَمَنْ شَاءَ صَامَ وَمَنْ شَاءَ أَفْطَرَ ‏.‏
Reference : Sahih Muslim 1113e
In-book reference : Book 13, Hadith 114
USC-MSA web (English) reference : Book 6, Hadith 2470
  (deprecated numbering scheme)