Many isolated DC-DC converters exist. Use one to power your battery charger.
Such converters are similar but not identical to other switching converters you may be familiar with, such as buck or boost converters, but the coil is replaced by two separate coils, making a transformer. The design may be slightly different to optimize energy transfer through the transformer. Feedback signals are opto-isolated.
You can get one that has the same voltage input and output, or you can get one that changes the voltage - a capability that comes practically for free since there's already a transformer in the middle.
Technically, it should be possible to make an isolated battery charger using the same principles, but it would be a quite niche part and I doubt they are made, so unless you want to make one from scratch, I would stick with an isolated converter feeding a normal battery charger. (Google tells me you can buy an isolated 12V lead-acid charger that is sometimes useful in some automotive applications like towing)