[Machine] The first prayer that was made obligatory was two units (rak'ahs). When the Prophet ﷺ arrived in Madinah and settled down, he added two more units of prayer, excluding the Maghrib prayer, because it is odd in number. As for the Fajr prayer, he added more units due to its lengthy recitation. It is said that when he traveled, he would perform his first prayer.
إِنَّ أَوَّلَ مَا فُرِضَتِ الصَّلَاةُ رَكْعَتَيْنِ فَلَمَّا قَدِمَ نَبِيُّ اللهِ ﷺ الْمَدِينَةَ وَاطْمَأَنَّ زَادَ رَكْعَتَيْنِ غَيْرَ الْمَغْرِبِ لِأَنَّهَا وِتْرٌ وَصَلَاةُ الْغَدَاةِ لِطُولِ قِرَاءَتِهَا قَالَتْ وَكَانَ إِذَا سَافَرَ صَلَّى صَلَاتَهُ الْأُولَى