The expansion tank manages pressure changes within the system, ensuring safe and efficient operation by preventing excessive pressure buildup during heating and cooling cycles.