Generally speaking, shortening the prayer while traveling is a legal concession that portrays Islam’s tolerance and simplicity in matters of worship. The Prophet used to shorten his prayer whenever he was on a journey. He (peace and blessings be upon him) is reported to have said: “Allah likes His servants to undertake the legal concessions given to them in the same way as He likes them to observe their obligations.”

The late Azharite scholar Sheikh Sayyed Sabiq (may Allah bless his soul) states the following: “A traveler is allowed to shorten his prayer. If he stays in a place waiting something to be fulfilled, he still may shorten his prayer, for he is considered a traveller, even if he stayed for years.

Ibn Al-Qayyim maintains that if a traveller intends to stay in a place for a specific period, he may shorten the prayer, because staying in a place during the journey for either a long or a short period does not nullify the state of traveling. This is provided that the traveller did not intend to reside in the place permanently.
There are many legal opinions, and they are summed up by Ibn Al-Qayyim, who finally confirms his own opinion saying that: “The Prophet (peace and blessings be upon him) shortened his prayer when he stayed in Tabuk for twenty days. He did not prevent people from shortening their prayers when they stay in a place for more than twenty days; rather, it happened that he stayed for such a period.”

Thus, staying in a place, in the course of traveling, whether for a long or a short period, is considered part of the journey of the traveller, so long as he does not intend to stay in such a place on a long-term basis.

This is an issue of debate between both precedent and antecedent jurists and scholars.

Imam Ahmad maintains that if a traveller intends to stay in a place for four days, he has to perform the whole prayer. And if he intends to stay for a shorter time, he may shorten it.

The Malikis and the Shafi`is consider that if a traveler intends to stay in a place for more than four days, he has to perform the whole prayer. If he intends to stay there for less than four days, he is allowed to shorten it.

Imam Abu Hanifah and Al-Layth Ibn Sa`d agree that a traveler has to perform the whole of his prayer if he intends to stay in a place for fifteen days, and he may shorten if he stays for less than that.

The four main schools of fiqh agree that if a traveler stays in a place awaiting something but he doesn’t know when will it be done, he can shorten his prayer.

But, the Shafi`is maintain that in such a case, a traveler can shorten his prayer for a period up to seventeen or eighteen days, but no more.