Involved in the synthesis of UDP-N-acetylglucosamine (UDP-GlcNAc) and UDP-N-acetylgalactosamine (UDP-GalNAc). Catalyzes the conversion of glucosamine-6-phosphate to glucosamine-1-phosphate and of galactosamine-6-phosphate to galactosamine-1-phosphate. alpha-D-glucosamine 1-phosphate = D-glucosamine 6-phosphate D-galactosamine 6-phosphate = alpha-D-galactosamine 1-phosphate Binds 1 Mg(2+) ion per subunit. Activated by phosphorylation. Belongs to the phosphohexose mutase family.