Most commonly from lanolin, a grease extracted from sheep's wool.
It's processed into (7-DHC), the same compound in human skin.
7-DHC is bombarded with UV light, triggering a chemical reaction that creates Vitamin D3.