Catalyzes cyclization of the linear tetrapyrrole, hydroxymethylbilane, to the macrocyclic uroporphyrinogen III, the branch point for the various sub-pathways leading to the wide diversity of porphyrins (PubMed:11689424, PubMed:18004775). Porphyrins act as cofactors for a multitude of enzymes that perform a variety of processes within the cell such as methionine synthesis (vitamin B12) or oxygen transport (heme).