How to switch power supply between two 24V batteries automatically & efficiently
The battery that is currently switched in must keep the other battery switched out until the first battery is drained, and once switched over must stay that way until the other battery drains (even after the first battery is replaced). This implies a symmetrical bistable circuit. 

Here is a possible solution using relays:-







simulate this circuit &ndash; Schematic created using CircuitLab

Each battery has a relay with a normally closed contact that keeps the other battery (and its relay) switched off. Whichever battery is connected first will have priority - until it is drained, then its relay will turn off and give control to the other battery.     

This circuit has a few potential problems. 


When the drained battery's relay releases and connects the other battery the voltage will rise, which may cause the relay to pick up again before the other relay has time to operate. If this happens the relays will chatter instead of switching over cleanly.      
The relays may become sensitive to mechanical shock or vibration when close to the release point, and the cutoff voltages may not be well defined.      
Relay contacts increase resistance and get noisier with use. Eventually the circuit may become unreliable.


For these reasons I would consider using a solid state circuit (comparators and logic gates or an MCU) to monitor the battery voltages and control the switchover, and MOSFETs to switch between batteries.