D buries himself to regain his strength from sunlight syndrome. He digs into the ground with only his head exposed in shaded area if possible. He is vulnerable to attacks during this time. How long he has to stay buried varies with the severity of his condition.
As shown in the Novel Scenes From An Unholy War, a hotel in the enter of the Village of Geneve. It's Sheriff Rust has trained the staff on how to treat Sunlight Syndrome. He has come into contact with D in the past, implying he has helped him in this situation before.