Sunan Abi Dawud Book 4, Hadith 32
I went on an expedition with the Messenger of Allah (ﷺ), and I was present with him at the conquest. He stayed eighteen days in Mecca and prayed only two rak'ahs (at each time of prayer). And he said: You who live in the town must pray four; we are travellers.
Ata' ibn AbuRabah asked Aisha: Can women offer prayer on a riding beast? She replied: They were not permitted to do so in hardship or comfort. Muhammad ibn Shu'ayb said: This (prohibition) applies to the obligatory prayers.
The Messenger of Allah (ﷺ) had a stop of seventeen days in Mecca and he shortened the prayer (i.e. prayed two rak'ahs at each time of prayer). Ibn Abbas said: He who stays seventeen days should shorten the prayer; and who stays more than that should offer complete prayer.
Abu Dawud said: The other version transmitted by Ibn 'Abbas through a different chain adds: He (the Prophet) had a stop of nineteen days (in Mecca).