Water heaters are lined with glass to prevent corrosion. Unlike metal, glass will not corrode.
In addition to being lined with glass, most water tanks are also made of steel. Both of these components together help ensure that the tank won't fail due to corrosion. Steel water tanks can still corrode due to rust, but will take much longer than a water heater made out of other materials.
According to Popular Mechanics, the number one reason that water heaters fail is due to corrosion.
The vent that carries water to and from the tank as well as the tank itself are also lined with glass due to the constant presence of water.
Just because your water tank is glass lined does not mean it will not eventually corrode in pipes and other places not protected by the glass. Due to the constant presence of water in the tank the steel will eventually begin to rust where it can produce holes. Once any type of hole appears in your water tank it will need to be replaced with a new unit.