Sahih Muslim 507 a
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
لَوْ يَعْلَمُ الْمَارُّ بَيْنَ يَدَىِ الْمُصَلِّي مَاذَا عَلَيْهِ لَكَانَ أَنْ يَقِفَ أَرْبَعِينَ خَيْرًا لَهُ مِنْ أَنْ يَمُرَّ بَيْنَ يَدَيْهِ "
Busr b Sa'id reported that Zaid b Khalid al-Juhani sent him to Abu Juhaim in order to ask him what he had heard from the Messenger of Allah (ﷺ) with regard to the passer in front of the worshipper. Abu Juhaim reported that the Messenger of Allah (ﷺ) said:
If anyone who passes in front of a man who is praying knew the responsibility he incurs, he would stand still forty (years) rather than to pass in front of him Abu Nadr said: I do not know whether he said forty days or months or years.
Full reference and source
Sahih Muslim 507 a In-book : Book 4, Hadith 294 USC-MSA web (English) : Book 4, Hadith 1027 (deprecated)
View source on Sunnah.com (opens in a new tab)