In your original circuit the regulator GND (which I assume you also connect to Arduino GND) is connected to the +12V midpoint of the batteries, the Vin of the regulator to the +24V pole of the battery pair.
Connecting Arduino GND to battery GND in this situation shorts the lower battery, and will cause sparks to fly.