Magnetic forces are caused by relativistic contraction when electrons are moving relative to atomic nuclei.
In 1820, André-Marie Ampère showed that parallel wires having currents in the same direction attract one another.