A gas water heater should easily last 20 years but you should be ready to replace it sooner just in case because there's no telling when something like a water heater will actually go out.
I've had a gas water heater last 20 years and another only 12 years so be prepared and have money in savings to replace it.
If a water heater lasts 20 years then I go ahead and get it replaced before it does decide to go out on me and potentially flood my basement.
20 years is a good lifespan and anymore time than that then your water heater is a ticking time bomb.