How can I detect which DC power source to send to an underwater camera housing?
You can absolutely share the same ground for as many voltages as you like.

Current flows to whatever loop is closed, so as long as you don't connect both positive and negative together the batteries won't even know about each other. That would be the easiest solution:







simulate this circuit &ndash; Schematic created using CircuitLab

R1 sees only 12V, R2 sees only 24V and neither battery can ever see the other.

And you can also just connect them like this, same idea:







simulate this circuit

Just make sure the load doesn't connect between the 12V and 24V, you'll get 12V, but it will run through both batteries and cause trouble when one is empty before the other.