Connecting grounds of a disconnected power source?
Yes, that will work.

Current can only flow through a closed circuit, so if you use a single switch-over contact relay with a high current rating and decently high DC voltage rating you are always sure only one can be connected at once. In a 24V vehicle, I'd go for 100VDC and 2.5* your peak current, because you don't want transients and load dumps to cause problems.

Note: To relays DC voltage is never the same as AC voltage! if it says "125V" only, it's likely AC voltage and DC voltage might be as low as 30V. Automotive relays from a decent manufacturer rated for 24V automotive DC have the proper contact finish to switch on and off vehicle DC often and without fail.

If you want to be completely sure of the safety of your battery from the alternator system if it's a device you want to produce, make sure the relay is an integral part of the Device-Battery system with only the one contact going out to alternator +.