Hi Lauren,
People have known about the Earth's magnetic field in one form or another for a very long time. Supposedly, people living in ancient China sometime around the 2nd century BC to 1st century AD had already figured out that a small piece of naturally magnetized iron ore (called lodestone) would always point in the same direction if it were suspended so it could move freely. This is how the first compasses were invented. Many centuries later, around 1600 AD, a British scientist named William Gilbert showed that the reason why a compass would always point in the same direction was that the Earth was a giant magnet. However it was not until the early part of the 20th century that we knew the Sun had a magnetic field. An American astronomer named George Ellery Hale was the first to observe the magnetic fields of sunspots using a spectroscope to study something called the Zeeman Effect. In the Zeeman effect, a magnetic field causes a spectral line to split into several components.
People have known about geomagnetic storms since the early 1800s, from observing the effects on compasses and telegraphs during bright auroral displays. A Norwegian scientist named Kristian Birkeland who performed laboratory experiments and conducted scientific polar expeditions was one of the first people to propose that geomagnetic storms were connected to the Sun around 1900. However, his theories were quite controversial at that time and could not be conclusively proven until the early 1960s when measurements from satellites became available.
Kris