The effects of magnetic fields on the energy of different electron configurations are rather small, especially for small atoms. The reason is essentially that the speeds of the electrons are low compared to c, and magnetism is just the velocity-dependent component of electricity required by Special Relativity. So the octet rule and other important chemical effects are not consequences of magnetic fields.
The numbers of electrons which can be placed in different energy "shells" depends instead on the numbers of distinct types of wave function shapes which have a given energy. The lowest energy states (with the fewest wiggles) are spherically symmetric. They hold two electrons because the two spin states are distinct.
(Bonds between atoms tend to contain two electrons, because if there is a low-energy waveform, it can fill with two electrons of opposite spins.)
Adding a wiggle to the state can give a different spherically symmetrical state or 3 distinct states with one unit of angular momentum. Allowing for spin makes a total of 8 different states.
Things get more complicated as one looks at atoms with even more electrons, because the interactions between the electrons become more and more important.
Mike W.
(published on 08/22/2010)