Praise be to Allah.
It is proven that if a Muslim child dies, he will be in a garden with Ibraaheem (peace be upon him).
It was narrated that Samurah ibn Jundub (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) often used to say to his companions: Has anyone among you seen a dream? And whoever Allah willed should do so would tell him [of a dream that he had seen]. One day, he said:
“Last night, two people came to me and woke me up…
They said: Come on, come on! So we set out, and we came to a verdant garden with all sorts of spring colours. In the midst of the garden there was a very tall man whose head I could hardly see because of his great height, and around him there were children in such large numbers as I have never seen. I said to my companions, What is this and who are those? But they said to me: Come on, come on…
… I said to them, I have seen many wonders tonight. What does all this mean which I have seen? They replied, 'We will tell you…
… As for the tall man whom you saw in the garden, he is Ibraaheem and the children around him are those children who die in a state of fitrah (sound human nature).” Some of the Muslims said: O Messenger of Allah, what about the children of the mushrikeen (polytheists)? The Messenger of Allah (blessings and peace of Allah be upon him) said: “And also the children of the mushrikeen.”
Narrated by al-Bukhaari (7047).
With regard to the deceased hearing the greeting of salaam given by the living, and being aware of him visiting his grave, this is a matter concerning which the scholars differed. We have explained previously that a number of the scholars are of the view that the reports are sound which indicate that the deceased is aware of the visit of the living, in the answer to question no. 111939.
Whatever the case, it is not appropriate to delve too deeply into such issues and try to find out how he knows that or is aware of it, and the like, because the realm of al-barzakh is part of the realm of the unseen, the details of which we have no way of knowing except from sound religious texts, namely the Qur’an and saheeh Sunnah.
But it may be said that with regard to the children of the Muslims, even though their souls are with Ibraaheem (peace be upon him), they have a connection of some type to their bodies that are in the graves. The same may also be said of the souls of the martyrs and others among the dead, for the soul has a connection of some type to the body.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: The souls of the believers, even though they are in Paradise, have a connection to the body by Allah’s leave, but not for a long time, just as the angels may descend in the blink of an eye.
Maalik (may Allah have mercy on him) said: I heard that the soul is free and may go wherever it wishes.
Hence it was narrated that it is in a space around the grave, and that it is in Paradise, and both are true.
In as-Sihaah it says that the soul will be restored to the body after death and will be questioned, and will respond, so it is undoubtedly connected to the body. And Allah knows best…
End quote from al-Fataawa al-Masriyyah (190).
And Allah knows best.