It was reported from the Messenger of Allah ﷺ that he prayed the traveler's prayer at Mina and elsewhere as two rakats, and Abu Bakr and Umar did the same, as did Uthman during the early part of his caliphate, after which he completed it as four.
و حدثني حرملة بن يحيى حدثنا ابن وهب أخبرني عمرو وهو ابن الحارث عن ابن شهاب
عن رسول الله ﷺ أنه صلى صلاة المسافر بمنى وغيره ركعتين وأبو بكر وعمر وعثمان ركعتين صدرا من خلافته ثم أتمها أربعا