We consider the different structures that a magnetic nanowire adsorbed on a surface may adopt under the influence of external magnetic or electric fields. First, we propose a theoretical framework based on an Ising-like extension of the 1D Frenkel-Kontorova model, which is analysed in detail using the transfer matrix formalism, determining a rich phase diagram displaying structural reconstructions at finite fields and an antiferromagnetic-paramagnetic phase transition of second order. Our conclusions are validated using ab initio calculations with density functional theory, paving the way for the search of actual materials where this complex phenomenon can be observed in the laboratory.