Muwatta Malik Book 9, Hadith 19
Yahya related to me from Malik from Ibn Shihab from Salim ibn
Abdullah that Abdullah ibn Umar used to say, "I pray the prayerof a
traveller as long as I am undecided whether to remain somewhere or
not, even if I am detained for twelve nights."
Yahya related to me from Malik that he had heard that Abdullah ibn Abbas used to shorten the prayer when he travelled a distance equivalent to that between Makka and Ta'if, and that between Makka and Usfan and that between Makka and Jedda.
Malik said, "That is four mail-stages, and to me that is the most preferable distance for shortening the prayer."
Malik said, "Someone who intends to travel does not shorten the prayer until he has left the houses of the village. And he does not do it in full until he comes to the first houses of the village, or is nearby."
Yahya related to me from Malik from Nafi that Ibn Umar stayed in Makka for ten nights, shortening the prayer, except when he prayed it behind an imam, in which case he followed the imam's prayer.