jofu:
The problem is that logically the battery is charged by a charge controller from the solar panel and therefore connected by some electrical circuit.
You need to understand that circuit.
If the solar panel and battery have a common earth, it would be possible to connect a voltage divider to each one and measure the voltage at the Arduino. Since this caused sparks and melted wires, presumably either they don't have a common earth or you messed up the wiring of the voltage dividers.
Just out of curiosity, are you expecting the two voltage measurements to tell you anything useful about what's happening? Have you tried measuring these voltages directly before implementing the Arduino-based monitoring solution?