Yes, the sentence "I was there when the casket was lowered into the ground/grave" is grammatically correct.
The sentence means that the speaker was present during a funeral or burial when the casket containing a deceased person's body was placed into the earth. It's a moment typically associated with mourning and saying goodbye.
Possible rephrasing could include:
1. "I was present when the casket was placed in the ground."
2. "I witnessed the