An expansion tank is used to accommodate the expansion of water that occurs during the heating process. It helps to relieve pressure in the plumbing system, prolonging the lifespan of the water heater and preventing damage to pipes and fixtures.