Originally, two rakʿat were prescribed in every prayer. When the Prophet ﷺ migrated (to Medina) four rakʿat were enjoined, while the journey prayer remained unchanged(i.e. two rakʿat).
فُرِضَتِ الصَّلاَةُ رَكْعَتَيْنِ ثُمَّ هَاجَرَ النَّبِيُّ ﷺ فَفُرِضَتْ أَرْبَعًا وَتُرِكَتْ صَلاَةُ السَّفَرِ عَلَى الأُولَى