One coil builds up a magnetic field when it is energized (and de-energized) and this induces an electric current in the other coil. The voltage produced in the second coil is determined by the number of coils wound on it compared to the first coil. This is called the turns ratio and only works with alternating current unless you are using it with a dc battery to make a spark in an ignition coil.
examples
primary 100 turns, secondary 200 , is a step up transformer
ie from 10 volts AC to 20 volts AC
100 turns primary, 50 turns secondary, step down transformer
ie from 10 volts AC to 5 volts AC