Abu Juhaym Abdullah ibn al-Harith al-Ansari (may Allah be pleased with him) said that the Messenger of Allah ﷺ said:
لو يعلم المار بين يدي المصلي ماذا عليه لكان ان يقف اربعين خيرا له من ان يمر بين يديه
“If the one who passes in front of a person praying knew how much sin he bears, it would be better for him to stand for forty (years) than to pass in front of him.”
It is narrated from Ata ibn Yasar (may Allah have mercy on him):
ان كعب الاحبار قال لو يعلم المار بين يدي المصلي ماذا عليه لكان ان يخسف به خيرا له من ان يمر بين يديه
“If the one who passes in front of a person praying knew the punishment for this act, being swallowed into the earth would seem better to him than passing in front of the one praying.”
Shaykh Salim Hilali has declared this hadith sahih (authentic)
مالك انه بلغه ان عبد الله بن عمر كان يكره ان يمر بين يدي النساء وهن يصلين
Malik (may Allah have mercy on him) reports that it reached him that Abdullah ibn Umar (may Allah be pleased with them both) disliked that one pass in front of women while they were praying.
These hadiths establish a very severe warning against passing in front of a person praying. But sadly, in this age people regard this act as easy, especially in the Two Holy Mosques, where people pass in front of those praying without any objection. The scholars there also do not pay attention to forbidding the common people.