Why is vitamin D essential to us?

Vitamin D is essential to us, not only for our mental health but our physical health as well. Where does it come from and how do we get more?