The prayer was first prescribed as two units. The travel prayer was left as it was, while the resident prayer was extended to its full length.
أخبرنا إسحق بن إبراهيم قال أنبأنا سفيان عن الزهري عن عروة
أول ما فرضت الصلاة ركعتين فأقرت صلاة السفر وأتمت صلاة الحضر
Bukhari narrated it in the Book of Shortening the Prayer, in the chapter, He shortens the prayer when he leaves his place, hadith no. 1090, and Muslim narrated it in the Book of the Prayer of Travelers, in the chapter on the prayer of travelers and shortening it, hadith no. 3/685, from the hadith of Sufyan bin Uyayna with this same chain, and it is also in al-Kubra, hadith no. 317.