How It Was Supposed to Work
By the end of the 1800s, the dominant theory of how light worked was that it was a wave of electromagnetic energy, because of experiments such as Young's double slit experiment.
The problem is that a wave had to move through some sort of medium ... something has to be there to do the waving. Light was known to travel through outer space (which scientists believed was a vacuum) and you could even create a vacuum chamber and shine a light through it, so all of the evidence made it clear that light could move through a region without any air or other matter.
To get around this problem, physicists hypothesized that there was a substance which filled the entire universe. They called this substance the luminous ether (or sometimes luminiferous aether, though it seems like this is just kind of throwing in pretentious-sounding syllables and vowels).
Michelson and Morley (probably mostly Michelson) came up with the idea that you should be able to measure the motion of the Earth through the ether. The ether was typically believed to be unmoving and static (except, of course, for the vibration), but the Earth was moving quickly.
Think about when you hang your hand out of the car window on a drive. Even if it's not windy, your own motion makes it seem windy. The same should be true for the ether. Even if it stood still, since the Earth moves, then light that goes in one direction should be moving faster along with the ether than light that goes in an opposite direction. Either way, so long as there was some sort of motion between the ether and the Earth, it should have created an effective "ether wind" that would have either pushed or hindered the motion of the light wave, similar to how a swimmer moves faster or slower depending on whether he is moving along with or against the current.
To test this hypothesis, Michelson and Morley (again, mostly Michelson) designed a device that split a beam of light and bounced it off mirrors so that it moved in different directions and finally hit the same target. The principle at work was that if two beams traveled the same distance along different paths through the ether, they should move at different speeds and therefore when they hit the final target screen those light beams would be slightly out of phase with each other, which would create a recognizable interference pattern. This device therefore came to be known as the Michelson interferometer (shown in the graphic at the top of this page).
The result was disappointing, because they found absolutely no evidence of the relative motion bias they were looking for. No matter which path the beam took, light seemed to be moving at precisely the same speed. These results were published in 1887. One other way to interpret the results at the time was to assume that the ether was somehow connected to the motion of the Earth, but no one really could come up with a model that allowed this that made sense.
In fact, in 1900 the British physicist Lord Kelvin famously indicated that this result was one of the two "clouds" that marred an otherwise complete understanding of the universe, with a general expectation that it would be resolved in relatively short order.
It would take nearly 20 years (and the work of Albert Einstein) to really get over the conceptual hurdles needed to abandon the ether model entirely and adopt the current model, in which light exhibits wave-particle duality.
You can find the full text of their paper published in the 1887 edition of the American Journal of Science, archived online at the AIP website.