“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).
كُنَّا نُصَلِّي وَالدَّوَابُّ تَمُرُّ بَيْنَ أَيْدِينَا فَذُكِرَ ذَلِكَ لِرَسُولِ اللَّهِ ﷺ فَقَالَ مِثْلُ مُؤْخِرَةِ الرَّحْلِ تَكُونُ بَيْنَ يَدَىْ أَحَدِكُمْ فَلاَ يَضُرُّهُ مَنْ مَرَّ بَيْنَ يَدَيْهِ