If you get a replacement battery from anyone other than the manufacturer of the UPS you will invalidate any warranty or connected-device guarantee/insurance that it is covered by and may actually invalidate warranties on the connected devices too (though "how would they know?" comes into play there).
If the UPS is out of warranty and offers no other guarantees/insurances then this is not an issue - though if the equipment/data that the UPS is serving is in any way remotely critical I would consider replacing the whole UPS at that point.
If buying a replacement battery from a supplier other then the one that made the UPS, check the small print of any guarantee very carefully. The original manufacturer's small print will no doubt be weasely enough, but the one from the aftermarket supplier may amount to nothing more than "use at your own risk".