Answer:
Yes. We know this from an examination of the
geological record. When lavas are deposited on the
Earth’s surface, and subsequently freeze, and when
sediments are deposited on ocean and lake bottoms, and
subsequently solidify, they often preserve a

signature
of the ambient magnetic field at the time of
deposition. This type of magnetization is known as 'paleomagnetism'.
Careful measurements of oriented samples of faintly
magnetized rocks taken from many geographical sites
allow scientists to work out the geological history of
the magnetic field.
We
can tell, for example, that the Earth has had a
magnetic field for at least 3.5 billion years, and
that the field has always exhibited a certain amount
of time-dependence, part of which is normal secular
variation, like that which we observe today, and part
of which is an occasional reversal of polarity.
Incredible
as it may seem, the magnetic field occasionally flips
over! The geomagnetic poles are currently roughly
coincident with the geographic poles, because the
rotation of the Earth is an important dynamical force
in the core, where the main part of the field is
generated. Occasionally, however, the secular
variation becomes sufficiently large such that the
magnetic poles end up being located rather distantly
from the geographic poles; we say that the poles have
undergone an ‘excursion’ from their preferred state.
Now,
we know from physics that the Earth’s dynamo is just
as capable of generating a magnetic field with a
polarity like that which we have today as it is
capable of generating a field with the opposite
polarity. The dynamo has no preference for a
particular polarity.
Therefore, after an excursional period of enhanced
secular variation, the magnetic field, upon returning
to its usual state of rough alignment with the Earth’s
rotational axis, could just as easily have one
polarity as another. The consequences of polarity
reversals for the compass are dramatic.
Nowadays,
the compass points roughly north, or, more precisely,
the north end of the compass points roughly north at
most geographical locations. However, before the last
reversal, which was about 780,000 years ago, the
polarity was reversed compared to today's, and the
compass would have pointed roughly south, and before
that reversed state the polarity was like that which
we have today, and the compass would have pointed
roughly north, and so on.
The
timings of reversals forms the so-called 'geomagnetic
polarity timescale', shown here at the right. During a
reversal, between polarities, the geometry of the
magnetic field is much more complicated than it is
now, and a compass could point in almost any direction
depending on one’s location on the Earth and the exact
form of the mid-transitional magnetic field.
One
of the things that is interesting about reversals is
that there is no apparent periodicity to their
occurrence. Reversals are random events. They can
happen as often as every 10 thousand years or so, and
as infrequently as every 50 million years or more.