Why can't you use a coil to transform 5 volts DC to 12 volts DC?
Just to be clear: we are talking about converting 5V DC into 12V DC.
The 2013 question is about DC-DC. Plus, there is a dc-dc-converter.

For a transformer to function, a varying magnetic field must be created inside it.  The varying current in the first winding (the so-called "primary" winding) creates a varying magnetic field, which in turn creates an electromotive force in the secondary winding. This does not happen when the primary is fed with pure DC.

Nevertheless, it is possible to make a transformer-based DC-DC converter.  DC is chopped so that the transformer is fed with varying current.  This is normally done with semiconductor switches.  The output of the transformer secondary is rectified, which produces a DC output voltage.

For a small increase in voltage (factor of 6x or less), an inductor-based boost converter is usually more practical than transformer-based (in general, although there are important exceptions).