As part of the heme biosynthetic pathway, catalyzes the sequential polymerization of four molecules of porphobilinogen to form hydroxymethylbilane, also known as preuroporphyrinogen. Catalysis begins with the assembly of the dipyrromethane cofactor by the apoenzyme from two molecules of porphobilinogen or from preuroporphyrinogen. The covalently linked cofactor acts as a primer, around which the tetrapyrrole product is assembled. In the last step of catalysis, the product, preuroporphyrinogen, is released, leaving the cofactor bound to the holodeaminase intact. H2O + 4 porphobilinogen = hydroxymethylbilane + 4 NH4(+) Binds 1 dipyrromethane group covalently. Porphyrin-containing compound metabolism; protoporphyrin-IX biosynthesis; coproporphyrinogen-III from 5-aminolevulinate: step 2/4. Monomer. Belongs to the HMBS family.