The prayer was originally prescribed as two rakahs. Then the Prophet ﷺ migrated, and it was made four rakahs, while the prayer during travel was left as it was originally prescribed.Abdul-Razzaq narrated it similarly from Muamar.
حدثنا مسدد حدثنا يزيد بن زريع حدثنا معمر عن الزهري عن عروة
فرضت الصلاة ركعتين ثم هاجر النبي ﷺ ففرضت أربعا وتركت صلاة السفر على الأولى تابعه عبد الرزاق عن معمر