Amir al-Sha'bi narrates from Sayyidah Aishah (may Allah be pleased with her) that the prayers were made obligatory as two rak'ahs each, except Maghrib, which was made obligatory as three rak'ahs. When the Prophet (peace and blessings be upon him) travelled, he would pray the original prayer, and when he stayed (as a resident) he would add two rak'ahs to each two, but not in Maghrib, because it is witr (odd), nor in the Fajr prayer, because its recitation is lengthy.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5443