When its unGrounded it sparks
When the Primary coil, inside an ignition coil gets 12volts and a ground it creates a magnetic field around the Secondary coil
The Primary coil just has a few windings(coils of wires)
Secondary has 1,000 times more windings
So the 12v becomes 12,000v in Secondary coil(low amps but high volts, its not creating "power")
When Primary coil's power is cut, either the 12v or the ground, the Primary's magnetic field "holding" the 12,000v in the Secondary coil collapses and the 12,000v is released, the spark
General description, if you are interested in exact numbers Google it
In general the reverse happens on AC voltage distribution
Wires on the poles outside carry 12,000vAC, transformers on the poles change it to 120vAC to be sent into your house
Just FYI