Riyad as-SalihinChapter 17Hadith 1079
Full Sharh — Riyad as-Salihin 1079
عن أبي الجهيم عبد الله بن الحارث بن الصمة الأنصاري رضي الله عنه قال: قال رسول الله صلى الله عليه وسلم : "لو يعلم المار بين المصلي ماذا عليه لكان أن يقف أربعين خيرًا له من أن يمر بين يديه" ((قال الراوي: لا أدري قال أربعين يومًا، أو أربعين شهرًا، أو أربعين سنة)). ((متفق عليه)).
English Translation
Abul-Juhaim 'Abdullah bin Al-Harith (May Allah be pleased with him) said:: The Messenger of Allah (ﷺ) said, "If the person who passes in front of a praying person, realizes the enormity of the sinfulness of this act, it will have been better for him to wait forty than to pass in front of him."
Source
Riyad as-Salihin(رياض الصالحين)
The Book of the Prohibited actions
Hadith Number
1079