It is used to treat or prevent bone loss (osteoporosis). Vitamin D is also used with other medications to treat low levels of calcium or phosphate caused by certain disorders (such as hypoparathyroidism, pseudohypoparathyroidism, familial hypophosphatemia).