Battery backup system for tankless gas water heater (outdoor install)
Technically, a UPS could be wired in, but there are a few caveats:


It depends on the electrical codes and gas codes in your area. The thought of making a change which might affect a gas-powered appliance would make me very cautious. Another worry would be an improperly isolated device feeding power back into the line, creating a shock hazard. Be sure to use an approved device, installed by a technician qualified in both gas and electric maintenance.
Though the UPS has ample power to operate the heater, the run-time is limited by battery size. A quick "off-the-cuff-" calculation: Assuming an 18 ampere-hour battery in the UPS, at 12 volts, gives a maximum of 216 watt-hours. Assuming a 20% duty-cycle, i.e. moderate use of water, the heater would use ~18 watts on average. With an 18 amp battery, you'd have about 12 hours of operation.
The UPS would need to be kept indoors, because a battery loses significant capacity in cold weather, and because the UPS is doubtless not designed for outdoor use.