Narated by Busr bin Said :
That Zaid bin Khalid sent him to Abi Juhaim to ask him what he had heard from Allah’s Apostle about a person passing in front of another person who was praying. Abu Juhaim replied, “Allah’s Apostle, Prophet Muhammad (ﷺ) said, ‘If the person who passes in front of another person in prayer knew the magnitude of his sin he would prefer to wait for 40 (days, months or years) rather than to pass in front of him.” Abu An-Nadr said, “I do not remember exactly whether he said 40 days, months or years.”
(Sahih Bukhari 489/510)@Entire_Path
If he passes in front of the one who is praying, i.e., in the area between the spot where he puts his forehead when he prostrates and where he stands, this is haraam, and indeed it is a major sin.
In this case it makes no different whether the person has a sutrah (object to serve as a screen) or not.
If he passes in the area that is beyond the place where he prostrates. Two scenarios may apply in this case:
(i) If the one who is praying has set up a sutrah (object to serve as a screen). In this case it is permissible to pass beyond the sutrah, because the Prophet Muhammad (ﷺ) said: “If any one of you prays, let him face towards something. If he cannot find anything, then let him set up a stick. If he cannot do that, then let him draw a line, then it will not matter if anyone passes in front of him.”
Narrated by Ahmad, 3/15; Ibn Maajah, 3063; Ibn Hibbaan, 2361. Ibn Hajar said in al-Buloogh, 249: The one who said that it is mudtarab (a kind of weak hadeeth) is not right; rather it is hasan.
And it was narrated that Talhah (may Allaah be pleased with him) said: The Messenger of Allaah, Prophet Muhammad (ﷺ) said: “If one of you puts something in front of him that is like the back of a saddle, then let him pray and not worry about anyone who passes beyond that.” Narrated by Muslim, 499.
(ii)If the one who is praying has not set up a sutrah, he has no more than the space in which he prostrates. This is the most correct scholarly opinion. It is permissible for the one who wants to pass in front of him to pass in the space beyond where he prostrates. That is because the prohibition mentioned in the hadeeth applies to passing in front of the one who is praying, and what is beyond the place where he prostrates is not counted as being in front of the one who is praying.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said, after mentioning the differences of scholarly opinion concerning the distance within which the worshipper should stop anyone from passing in front of him:
The most correct opinion is that it is the distance between his feet and the place where he prostrates. That is because the one who is praying has no right to anything more than what he needs for his prayer. So he does not have the right to prevent the people from (using space) that he does not need.
Al-Sharh al-Mumti’, 3/340.
All of this has to do with one who is praying alone or is leading others in prayer. If he is a member of a congregation, then the sutrah of the imam is the sutrah for those who are behind him.
Al-Bukhaari (may Allaah have mercy on him) said: Baab sutrat al-imam sutrah li man khalfahu (the sutrah of the imam is the sutrah of those who are behind him).
It was narrated that Ibn ‘Abbaas said: Once I came riding a female donkey and had (just) attained the age of puberty. The Messenger of Allaah (peace and blessings of Allaah be upon him) praying at Mina, and there was no wall in front of him. I passed in front of part of the row while they were praying. Then I let the donkey loose to graze and joined the row, and nobody objected to it. (Narrated by al-Bukhaari, 76; Muslim, 504)
See al-Mughni, (2/42, 2/46)
And Allah knows best.