virtual particles...hmmmm...what does that really mean. is it the same kind of thinking that leads people to invent dark matter, dark energy, and dark flow? I need to read more. tnx for the link.
Technoob has already posted the classical electromagnetic explanation. Materials contain microscopic loop currents which are also called magnetic moments. These magnetic moments normally point in random orientations which gives rise to no net magnetic fields. However, under the influence of an applied magnetic field, these dipoles will line up and generate secondary magnetic fields that oppose the applied field. This is how the permeability of a material works. In ferromagnets, large regions, called domains, naturally have a preferred direction for their dipoles without any applied fields. If we can induce these domains to line up and stay that way (which we can do by heating and applying a very large magnetic field), then we can create a permanent magnet since we can cause large numbers of these dipoles to line up and work together to create a magnetic field.
In quantum mechanics, we find that the atoms create these dipole moments, which were loop currents in classical electromagnetics, by two ways. The primary means is the intrinsic spin of the particles. Electrons and protons have a permanent magnetic dipole associated with them due to their "spin." It is the electron's spin that gives rise to the main magnetic field. There is also another magnetic field contribution from the electron's orbital momentum as it orbits the nucleus. These two small microscopic moments give rise to the macroscopic atomic magnetic fields.
disappoint is talking about quantum electrodynamics which discusses the nature of the electromagnetic field in terms of a relativistic quantum field theory. In QED, the basic constituents of the electromagnetic field are the scalar and vector potentials, not the electric and magnetic fields. The fields, instead, are the observables of the quantized potentials. The fields are propagated by photons and it is an easily acceptable picture for most people to view this in terms of electromagnetic waves. We state that electromagnetic waves, which are the time-varying coupled electric and magnetic fields, are propagated by photons and people can easily imagine these photons going out in space creating the fields as they go along. Eh, close enough. However, electomagnetic fields do not exist at DC. At DC, the electric and magnetic fields are completely decoupled and the question then becomes how do we mediate the electromagnetic force when there are no photons (only the waves have photons).
This is solved by the idea of virtual particles. It is important to point out that virtual particles are a mathematical tool and one should not try to glean too much physical insight from them as a result. What it comes down to is that on very small time scales, the Heisenberg Uncertainty Principle states that we will observe a very large spread of energies in the associated wavefunction. In this case, what we mean is that on very short time intervals, the electromagnetic field, or the vacuum field even if we have no sources, can have widely fluctuating energy levels. Using the equivalence principle from Relativity, we know that energy and matter are interchangeable and thus if the energy fluctuates high enough, a particle can pop out of the vacuum. However, because the energy only fluctuates over a very small time interval, this particle must quickly turn back into energy and return to the vacuum.
In short, there are "virtual" photons that pop in and out of existence over very very small time intervals. We call them virtual because they do not persist in time. These virtual photons are the mediators of the static fields.