Abu Huraira reported God’s Messenger as saying, “A woman, an ass and a dog cut off the prayer, but something like the back of a saddle guards against that.”
Ibn ‘Abbas said, “When I was near the age of puberty I came riding on a she-ass and found God’s Messenger leading the people in prayer at Mina with no wall in front of him. I passed in front of part of the row of worshippers, and dismounting, let my she-ass go to pasture and joined the row, and no one objected to that.”
Abu Sa'id reported God’s Messenger as saying, “When one of you prays facing something which conceals him from people and someone wishes to pass in front of him, he should turn away; but if he refuses to go, he should turn him away forcibly, for he is only a devil.”
This is Bukhari’s wording, and Muslim has something to the same effect.