DMDM hydantoin is a preservative that slowly releases formaldehyde in order to stop certain bacteria from growing when a product comes into contact with water. It is used to stop the shampoos and conditioners that contain it from getting moldy in the shower.