How? Currently, waterproofing works by slathering every crack and crevice in a sea of glue. Glue and easily replaceable batteries don’t mix.
The S5 had waterproofing with a removable back using gaskets. (Granted, the design was fugly, but that wasn’t the fault of the waterproofing measures. Someone at Samsung loved bandaids) If the S5 could do it, I suppose other manufacturers could achieve the same thing with rubber gaskets. I mean, other waterproof gadgets like dive computers use gaskets on their port covers and what not, so I fail to see why it wouldn’t work with battery compartments.