Potentiometric titration, FTIR spectroscopy, 13C solid-state NMR spectroscopy and chemical analysis were used to study the gelation of technical lignins (oxidized hydrolysis, kraft, soda and lignosulfonates) and Pepper lignin in interaction with metal salts (CaCl2, Mg(NO3)2, FeSO4, Co(NO3)2, Pb(NO3)2, Fe(NO3)3, CuSO4, AgNO3). It has been found that compounds that are salts of weak base and strong acid possess an ability to gelation; the metal cation has a standard potential above a certain value, has moderate hydrolysis ability and the cation hydroxide formed in the hydrolysis reaction has a relatively low solubility. At the gel formation, a compounds of the composition R–COO–Mez +–OOC–R, z = 2, 3 were formed. A scheme of intermolecular bonds at the point of lignin hydrogel formation was proposed, according to which, adjacent lignin molecules bound to each other by three types of bonds: ionic between carboxyl groups of lignin and metal cation, coordination between metal cation and water molecules included in the coordination sphere, and hydrogen bonds, binding all components of the system into a single whole. Lignin hydrogels have a high sorption ability with respect to heavy metals such as lead, iron and copper, that, depending on the content of acid groups in lignin and the molar mass of the sorbate, is approximately 25–50% by weight of lignin. This opens up the possibility of using a new type of lignin hydrogels for wastewater treatment of chemical plants.