The magnetosphere refers to the region of magnetic influence of a celestial body. This varies depending on the size of the body and the magnetism it generates. Earth's magnetosphere is defined by the region in which the motions of charged particles are largely determined by earth's influence. This effect extends out to about 10 earth radii (63,731 km or 39,123 mi). Certain bodies known for their magnetism, such as magnetars, a form of pulsar, have magnetospheres tens of millions of miles wide.
Not every astronomical object has a magnetosphere. All planets in the solar system do, except for the possible exception of Pluto. Icy moons are examples of bodies that lack a magnetosphere. The magnetosphere is created through electric currents flowing in space and has nothing to do with ferromagnetic materials.
The magnetosphere repels the sun's solar wind, which consists of charged particles, creating a large wake of these particles in space, much like a speedboat. The archetypal textbook image of the magnetosphere shows solar wind being deflected around it.
The magnetosphere was only discovered quite recently -- in 1958 by Explorer I, the second-ever-launched earth-orbiting satellite. Its source is a dynamo process the metals in the earth's core are undergoing. We had known before, obviously, that the earth possessed a magnetic field, but weren't sure whether or not it influenced particles in space. In the same way that the magnetic north deviates from true north, the orientation of the magnetosphere is slightly offset from the rotation of the earth.
Unlike the earth itself, the magnetosphere is not even roughly spherical in shape. It is deformed by the solar wind. This stellar plasma is resistant to mixing with ions captured in the earth's magnetic field.
The magnetosphere serves an important function shielding us from some of the energy particles created by cosmic waves. The upper atmosphere intercepts energetic particles and circulates them throughout the magnetosphere. These trapped particles are called the Van Allen Radiation Belts, or more simply, Van Allen Belts.