Language:
كتاب الصلاة
8  
Prayers (Salat)
(101)
Chapter: The sin of a person who passes in front of a person offering Salat
(101)
باب إِثْمِ الْمَارِّ بَيْنَ يَدَىِ الْمُصَلِّي
Sahih al-Bukhari 510

Narrated Busr bin Sa`id:

that Zaid bin Khalid sent him to Abi Juhaim to ask him what he had heard from Allah's Messenger (ﷺ) about a person passing in front of another person who was praying. Abu Juhaim replied, "Allah's Messenger (ﷺ) 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."

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ، قَالَ أَخْبَرَنَا مَالِكٌ، عَنْ أَبِي النَّضْرِ، مَوْلَى عُمَرَ بْنِ عُبَيْدِ اللَّهِ عَنْ بُسْرِ بْنِ سَعِيدٍ، أَنَّ زَيْدَ بْنَ خَالِدٍ، أَرْسَلَهُ إِلَى أَبِي جُهَيْمٍ يَسْأَلُهُ مَاذَا سَمِعَ مِنْ، رَسُولِ اللَّهِ صلى الله عليه وسلم فِي الْمَارِّ بَيْنَ يَدَىِ الْمُصَلِّي فَقَالَ أَبُو جُهَيْمٍ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ لَوْ يَعْلَمُ الْمَارُّ بَيْنَ يَدَىِ الْمُصَلِّي مَاذَا عَلَيْهِ لَكَانَ أَنْ يَقِفَ أَرْبَعِينَ خَيْرًا لَهُ مِنْ أَنْ يَمُرَّ بَيْنَ يَدَيْهِ ‏"‏‏.‏ قَالَ أَبُو النَّضْرِ لاَ أَدْرِي أَقَالَ أَرْبَعِينَ يَوْمًا أَوْ شَهْرًا أَوْ سَنَةً‏.‏
Reference : Sahih al-Bukhari 510
In-book reference : Book 8, Hadith 157
USC-MSA web (English) reference : Vol. 1, Book 9, Hadith 489
  (deprecated numbering scheme)