Use of sunlight in biological processes
We don't get it from the sun, it's synthesized.

Humans can get it...


via nutrition.
via synthesis in the skin, which depends on UV radiation. Sun is the major source of it (the radiation, not the vitamin), and synthesis in the skin the major source of the vitamin. However, it needs further modification in the liver or kidney to become bioactive. UV radiation is necessary and directly causing the opening of a cyclic molecule structure, changing a cholesterol to a previtamin D3.


For more details see chapter 'Biosynthesis' at https://en.wikipedia.org/wiki/Vitamin_D