This can stress the tank. It is best to install an expansion tank at the same time you install a new heater. The expansion tank contains pressurized air and a rubber bladder. When the hot water expands, it pushes into the tank. As it cools, the bladder pushes the water back into the piping system.
Expansion tanks work like shock absorbers on cars.
Inspect your chimney when you install a new heater. Make sure the chimney is clear of debris. This will prevent carbon monoxide accidents. Install the shut-off valve on the cold water pipe only. Make sure the valve is sized for the heater.