Should a gas water heater be shut down if the water main has to be turned off?
Water heaters have a dip tube on the cold water side that puts the cold water into the bottom of the tank. If water pressure is lost on the cold water side, the tank can siphon down through the cold water inlet till it reaches the bottom of the dip tube. Then since there's no water in the tank to absorb heat, the dip tube can melt and the tank can be damaged.

It would be best to at least set the heater so it is on pilot only.

Note: Manufacturer AO Smith states in their manuals that their gas water heaters must not be operated without being certain it's filled or with the cold water inlet shutoff valve closed.