From ʿAbd Allāh ibn Masʿūd, may Allāh be pleased with him, from the Prophet ﷺ, that he said:
The order was given for a slave from among Allāh’s slaves to be struck with a whip 100 times in his grave, so he kept asking [of] and calling [upon Allāh] until it became a single whipping. Thereafter, he was given a single whipping, upon which his grave filled over him with fire.
Then when [that] was lifted from him, he came to [his senses]. He said: “What did you whip me for?”
It was then said to him: “Indeed, you prayed one prayer without having been in a state of ritual purity, and you passed by someone being oppressed without coming to his aid.”
Al-Ṭaḥāwī reported it in Mushkil Al-Āthār, 4/231. See Al-Silsilah Al-Ṣaḥīḥah by Al-Albānī (2774) where Al‐Albānī says its chain of narration is good.