... how does the second coil know the voltage of the first coil?
Only indirectly, via the flux in the core. The rate of change of flux gives the induced voltage per turn in all coils linked to that flux, both primary and secondary. More turns, more voltage, same turns, same voltage.