The Messenger of Allah (ﷺ) said four rak'ahs in the noon prayer while at Medina, but he offered two rak'ahs in the afternoon prayer at Dhu'l-Hulaifa.
The Book of Prayer - Travellers
Sahih Muslim 690 a
Hadith Text
The Messenger of Allah (ﷺ) said four rak'ahs in the noon prayer while at Medina, but he offered two rak'ahs in the afternoon prayer at Dhu'l-Hulaifa.
Commentary
This hadith establishes the fundamental principle of qasr (shortening prayers) for travelers in Islamic jurisprudence. The Prophet (ﷺ) performed the complete four rak'ahs of Dhuhr prayer while resident in Medina, demonstrating the obligation of full prayers during residence. However, at Dhu'l-Hulaifa - the miqat for Medinan travelers - he shortened the Asr prayer to two rak'ahs, thereby instituting the practice of qasr for travelers.
The scholars have derived from this that the minimum distance requiring prayer shortening is approximately 48 miles (80 km), which is the distance between Medina and Dhu'l-Hulaifa. The shortening applies to the four-rak'ah prayers only, while Maghrib and Fajr remain unchanged. This concession reflects Allah's mercy in facilitating worship during travel, acknowledging the hardships of journey.
The wisdom behind this legislation includes relieving the traveler from difficulty, following the Sunnah of previous prophets, and maintaining the connection with Allah while accommodating travel circumstances. The traveler may choose between shortening prayers or completing them, though shortening is preferred according to most scholars.