The biosynthesis of heparan sulfate occurs in the Golgi apparatus of cells. The process involves the sequential addition of sugar residues to a core protein, followed by specific sulfation and epimerization reactions. Enzymes such as glycosyltransferases and sulfotransferases play crucial roles in this complex biosynthetic pathway.