Catalyzes cyclization of the linear tetrapyrrole, hydroxymethylbilane, to the macrocyclic uroporphyrinogen III, a precursor of tetrapyrroles such as chlorophyll, heme and phycobilins. hydroxymethylbilane = H2O + uroporphyrinogen III Porphyrin-containing compound metabolism; protoporphyrin-IX biosynthesis; coproporphyrinogen-III from 5-aminolevulinate: step 3/4. Belongs to the uroporphyrinogen-III synthase family.