'A'isha reported: The Holy Prophet (ﷺ) entered my house when a Jewess was with me and she was saying: Do you know that you would be put to trial in the grave? The Messenger of Allah (ﷺ) trembled (on hearing this) and said: It is the Jews only who would-be put to trial. 'A'isha said: We passed some nights and then the Messenger of Allah (ﷺ) said: Do you know that it has been revealed to me:" You would be put to trial in the grave"? 'A'isha said: 1 heard the Messenger of Allah (ﷺ) seeking refuge from the torment of the grave after this.
Shaykh Maulana Abdul Aziz Alvi
Hadith Commentary:Benefits and Issues: The Prophet Muhammad (sallallahu alayhi wa sallam) did not have knowledge that Muslims would also have to undergo the trial of the grave. Therefore, he (sallallahu alayhi wa sallam) specified it as pertaining to the Jews, because the Jewish woman had acknowledged the trial in the grave. Later, Allah, the Exalted, informed him through revelation that his (sallallahu alayhi wa sallam) Ummah would also undergo this trial. From this, it is established that the Prophet (sallallahu alayhi wa sallam) is aware of the conditions of the grave and the Barzakh only to the extent that Allah, the Exalted, has informed him.
Source: Tuhfat al-Muslim: Commentary on Sahih Muslim, Page: 1319