You're forgetting that the projectile also has a magnetic field. It's the opposing magnetic fields between the projectile and the rails that propel the projectile. The magnetic field generated by the rails is essentially "fixed" to the barrel. The force generated by the two fields both push the projectile out (at an extreme velocity) and also push the weapon back (recoil).
Recoil is very much a consideration. The larger the projectile (such as a larger guided projectile vs. a simple slug) the more recoil there is.