Sunan Ibn Majah Book 5, Hadith 138
“We used
to
perform prayer while the beasts were passing in front of us. That
was
mentioned to the Messenger of Allah (ﷺ) and he said: ‘If
something like the hand of a saddle* is placed in front of anyone of
you, it will not matter whoever passes in front of him.”
* It is the piece of wood on the camel saddle which is held on to (to climb onto the camel).
“Allahu Akbar, Allahu Akbar, Ashhadu an la ilaha illallah, Ashhadu anna Muhammadan Rasulullah (Allah is the Most Great, Allah is Most Great, I bear witness that none has the right to be worshipped but Allah, I bear witness that Muhammad is the Messenger of Allah).” Then he (Ibn ‘Abbas) said: “Proclaim to the people that they should pray in their houses.” The people said to him: “What is this that you have done?” He said: “One who is better than me did that. Are you telling me that I should bring the people out of their houses and make them come to me wading through the mud up to their knees?”
“A small spear (Harbah) would be brought out to the Prophet (ﷺ) when he was travelling; he would plant it (in the ground) to perform prayer while facing it.”