So, what is the harmonic oscillator? Otherwise known as the simple harmonic oscillator, it is the physical situation in which a particle is subject to a force whose strength is proportional to the displacement from equilibrium of said particle, known as Hooke's Law, or, in math terms,
F = -kx
where F is our force, x is our displacement, and k is some proportionality constant (often called the "spring constant"). That sounds swell and all, but to what situations does this apply? Well, for a simple example, consider a mass suspended on a spring. If you just let it sit in equilibrium, it doesn't really move since the spring is cancelling out the force of gravity. However, if you pull the mass slightly off of its equilibrium point and release it, the spring pulls the mass up, compresses, pushes the mass down, and repeats the process over and over. So long as there is no outside force or friction (a physicist's dream) this will continue oscillating into eternity, and the position of the mass can be mapped as a sine or cosine function.
What is the period of the oscillation? Well, it turns out that the square of the period is related to the mass and the spring constant, k in this fashion:
T2 = 4π2m/k
This is usually written in terms of angular frequency, which is 2π/T. This gives us the equation
(2π/T)2 = ω2 = k/m
This problem is also a great example of a system where total energy, call it E, is conserved. At the peak of the oscillation (when the mass is instantaneously at rest), all energy is potential energy, since the particle is at rest and there is no energy of motion. At the middle of the oscillation (when the mass is at equilibrium and moving at its fastest) the potential energy is at a minimum (zero) and the all energy in the system is kinetic energy. Kinetic energy, denoted by T (and not to be confused with period) is equal to mv2/2, and the kinetic energy of the simple harmonic oscillator is kx2/2. Thus, the total energy can be written as
E = mv2/2 + kx2/2 = p2/2m + kx2/2
Where I've made the substitution p = mv. Advanced physics students will note that this is the Hamiltonian for the simple harmonic oscillator.
Well, this is great for masses on springs, but what about more natural phenomena? What does this apply to? Well, if you like music, simple harmonic oscillation is what air undergoes when you play a wind instrument. Or a string instrument. Or anything that makes some sort of vibration. What you're doing when you play an instrument (or sing) is forcing air, string(s), or electric charge (for electronic instruments) out of equilibrium. This causes the air, string(s), and current to oscillate, which creates a tone. Patch a bunch of these tones together in the form of chords, melodies, and harmonies, and you've created music. A simpler situation is blowing over a soda/pop bottle. When you blow air over the mouth of the bottle, you create an equilibrium pressure for the air above the mouth of the bottle. Air that is slightly off of this equilibrium will oscillate in and out of the bottle, producing a pure tone. Also, if you have two atoms that can bond, the bonds that are made can act as Hooke's Law potentials. This means that, if you vibrate these atoms at a specific frequency, they will start to oscillate. This can tell physicists and chemists about the bond-lengths of molecules and what those bonds are made up of. In fact, the quantum mechanical harmonic oscillator is a major topic of interest because the potential energy between particles can often be approximated as a Hooke's Law potential near minima, even if it's much more complex elsewhere.
Also, for small angles of oscillation, pendula act as simple harmonic oscillators, and these can be used to keep track of time since the period of a pendulum can be determined by the length of its support. Nowadays, currents sent through quartz crystals provide the oscillations for timekeeping more often than pendula, but when you see an old grandfather clock from the olden days, you'll know that the pendulum inside the body is what keeps its time.
Hopefully you can now see why we physicists solve this problem so many times on our journey to physics maturity.