The inside of the Earth is not solid. It is actually part viscous fluid, part solid. The innermost core is solid, but the outermost core and the mantle are both fluid.
The Earth's magnetic field is actually generated by the outermost part of the core, called the geodynamo. This consists of molten iron alloys, and produces at magnetic field that at the moment is similar to that which would be produced by a bar magnet oriented at about 11 ° to the poles. Because the field is produced by the molten outer core, it moves as this molten fluid moves.
At non constant intervals between 100,000 to 50 million years, the magnetic poles reverse polarity, so that North and South poles interchange. These pole reversals leave a record in iron ores in volcanic rocks and rocks formed at the ocean floor where the Earth's plates are moving apart. We can deduce the history of the Earth's magnetic field by analysing the magnetisation of these ores and the ages of the rocks in which they are found.
The Earth's magnetic field is important because it acts to shield us, and many of our satellites, used for navigation, communication, science and monitoring, from the solar wind, a stream of particles emitted from the Sun.
" >Sailors use a compass, which points in the direction of the Earth's field to aid in navigation. This method is reduced in importance because of the increase in the use of GPS.