Praise be to Allah.
The trial of the grave, and the questioning of the person in his grave, about his Lord, about his religion and about his Prophet, is a trial that is undergone by every accountable person in his grave. Whoever Allah makes steadfast and he answers will be saved and will be granted bliss in his grave, but whoever is tested and does not answer will be doomed. This is indicated by shar‘i evidence.
Every accountable person who undergoes this questioning will undergo it after his death, no matter what his situation, whether he is buried in a graveyard or not, whether all of his body or part of it is buried, whether he died on his bed, or drowned in the sea, or was burned to death, or cut into pieces, or eaten by wild animals, no matter where and how he died.
An-Nawawi (may Allah have mercy on him) said: Our companions (i.e., the Shaafa‘is) said:
The questioning of the two angels and the torment of the grave cannot be ruled out because of the body of the deceased being scattered, as we usually see, or by his being eaten by wild animals or fish in the sea, and the like. Just as Allah, may He be exalted, will bring him back to life for the resurrection, and He, may He be glorified and exalted, is able to do that, in like manner He is able to bring part of him back to life, or several parts, even if he has been eaten by wild animals or fish.
End quote from Sharh Saheeh Muslim (17/201)
As-Suyooti (may Allah have mercy on him) said in his poem Abyaat at-Tathbeet (83):
The unburied person and the crucified person are questioned, although the living are not able to see that.
The commentator on the poem said:
The questioning is something that will happen to everyone who dies, no matter how he died, whether it was by knocked to the ground or by drowning or by being thrown into the fire, or being eaten by wild animals or birds, because of the general meaning of the evidence that speaks of this questioning… end quote.
Shaykh Ibn Baaz (may Allah have mercy on him) said:
The grave is either one of the gardens of Paradise or one of the ditches of Hell, and punishment or bliss happen to both the soul and body in the grave… and also in the hereafter. The delights of Paradise affect both the soul and the body, and the torments of Hell affect both the soul and the body.
If a person dies by drowning or by burning, or by being devoured by wild animals, the soul experiences its share of torment or bliss, and the one whose body is in the sea or was burned or is in the bellies of wild animals will also have its share of that, in a manner that is known to Allah, may He be glorified and exalted.
End quote from Fataawa Noor ‘ala ad-Darb (4/304)
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Is this – namely the trial of the grave – something that is only for the one who is buried in a grave, because of the words “When the deceased is buried”, or does it apply to everyone who dies?
Answer: this is not only for the one who is buried in a grave; rather it includes everyone who dies. The words of the Prophet (blessings and peace of Allah be upon him), “When the deceased is buried…” are based on what is usually the case.
Based on that, if a person is knocked to the ground [and remains unburied] or thrown into the sea and dies there, then the two angels will come to him and test him.
End quote from Sharh al-‘Aqeedah as-Safaareeniyyah (1/433)
So whether the deceased is buried in the proper manner or not, the two angels will come to him and will test him in his grave, and they will ask him in a manner that is known to Allah, may He be exalted.
And Allah knows best.