what is a magnetic field?
In electrodynamics the magnetic field is BY DEFINITION the field generated by the electric charges that moves. It does not matter if the electric charges are located in a physical medium (wire) or in vacuum.
It was shown (by the year 1860) also that a variable (over time) electric field generates a variable magnetic field and viceversa (see Maxwell ecuations). This way both the elctric and magnetic fileds were unified into a single field named the electromagnetic field.
Again, it is demonstarted in electrodynamics that the speed of propagation of a perturbation (a change) in the electromagnetic field (and hence in magnetic field) is equal to the speed of light.
From this physics theory dealing with electric and magnetic fields (electrodynamics) 50 years lter emerged the theory of relativity.
To come back to magnetism, as said in the previous answer, magetism of materials in nature is caused by the arrangement of valence electrons (thus moving electrical charges) into neighbouring atoms. More precisely if the valence electrons have parallel spins they add toghether reulting in strong magnetic properties (the materials are said to be feromagnetic). In contrast if the spins of valence electrons in neghbouring atoms are opposite the magnetic properties are weak (the materials are said to be diamgnetic or even paramagnetic). Permanent strong magnets in technical applications (loudspeakers for example) are made out of feromagnetic materials that were subject to a strong external magnetic field and become permanently magnetized.
A magnet generates a magnetic field in the space surrounding. The direction of magnetic field at any point is taken as the direction of the resultant force acting on a hypothetical north pole placed there. A south pole will move in a direction opposite to that of the field. Thus if a tiny compass is placed there, a line drawn from its south pole to its north pole indicates the direction of the magnetic field.
Magnetism is caused by the way atoms are arranged in materials. Nearly all solids objects are crystals; that is, their atoms are arranged in regular patterns. These atoms contain electron, tiny, negatively charged particles whose spin creates a tiny magnetic field about each one. The atoms of many elements may be thought of as tiny magnets because of this spinning of their electrons, each with a north and a south pole.