To charge a battery, you need a battery charger.
That's because the charger needs to do multi-stage charging that is correct for the battery type you are charging - lead-acid, lithium-xxxx, etc. so it doesn't
- hydrolyze all the water out of a lead-acid wet cell
- destroy a sealed lead-acid by hydrolyzing the electrolyte
- set a lithium pack spectacularly on fire
They do, in fact, make battery chargers which input 12V and charge various 24V-range battery packs. They are rare and "boutique" so expect to mail order it and pay a lot.
However, you can do it with readily available commercial off-the-shelf parts: use any common 12V inverter to make 120V then use any common 24V battery charger to charge the larger pack.
If you are running an engine to get this power, the inverter -> 120V charger chain makes the most sense, because the 12-120-24 double-conversion efficiency losses are coming from fuel, and you can find those two components at nearly any truck stop anywhere.