The speaker imagines their own death and speaks to their shadow, asking it to stop for a moment at the grave. Under a blinding sun, the shadow is the one thing that still belongs to the speaker, and it becomes a companion for the end of life. The line "I will be content with thee" shows a quiet acceptance. The speaker doesn't ask for much, only a pause and some company.
The second half looks forward. The speaker pictures a tree growing from their remains, so that death turns into new life. The shade of that tree is where the shadow is asked to stay "forever." The sun that first felt harsh is now softened by leaves, and the shadow finds rest there. The mood is calm and tender, with no fear of dying. The poem treats death as a gentle change, where the speaker's body feeds something living and the loneliness of the grave is eased.