Let's first step back to 1898. Martians were invading the Earth. Well, at least, they were in H. G. Wells' The War of the Worlds. The Martian's tripods were equipped with heat rays that they used to destroy, well, everything. This is the most significant early example of the raygun. It may not have been the first (I don't actually know, but I couldn't find anything earlier), but anything that was earlier has been mostly forgotten.
Rayguns in fiction became increasingly popular through the early 20th century. In fact, they sort of became standard fare in pulp science fiction including Buck Rogers, Flash Gordon, and others. They also became pretty standard in comic books.
1930s edition Buck Rogers raygun
Then, Einstein happened...
Well, let's re-examine that. In 1917, Einstein put forth the Quantum Theory of Radiation which established the theoretic foundation for irradiating light waves. It's this theory that would later lead to lasers. But, in the meantime, rayguns flourished in fiction.
And, now, we're to the part where, maybe, this entry should have been placed under the letter R. Prior to World War II, there was research going on to develop rayguns (in the United States, at any rate, and, possibly, in Germany (actually, probably, everywhere, but I don't have that information)). That research coupled with some of Tesla's ideas (also from 1917) lead to the development of radar.
But we still didn't have any rayguns.
Finally, in the '50s, the first significant breakthroughs in laser technology began to happen, and, in 1959, Gordon Gould published the term L.A.S.E.R. (Light Amplification by Stimulated Emission of Radiation). The first operating laser followed in 1960. Science fiction went crazy, dropping rayguns for laser guns. But only for a moment...
One interesting factoid about that:
The original Star Trek had two pilot episodes. I bet some of you even knew that. The first pilot episode, "The Cage," was produced in 1964 (and remained unreleased until 1988) and included lasers. The first pilot didn't convince the studio that the concept would work, but they were still intrigued by the idea, so they made the odd request for a second pilot, "Where No Man Has Gone Before." The interesting bit? It had already become apparent by the time of the 1966 production of the new pilot that lasers were not going to be practical as guns or weapons, so they changed the name of the devices in Star Trek to "phasers."
But the military really wanted laser weapons, and science fiction continued to be full of laser type weapons even if they didn't call them lasers. Star Wars got blasters, Doctor Who had stasers and all sorts of other things, and Starblazers got a wave motion gun just to name a few. And the military... well, they made this big laser and mounted it on the top of an airplane and sent it up to shoot down drones or something. But it was a cloudy day, and the clouds totally dissipated the lasers, and the project was mostly dropped (and, no, I can't tell you where I got that information (yes, if I did, I would have to kill you)).
This, of course, did not stop Reagan from creating the Star Wars program in the '80s. That almost did work; they just couldn't get enough range out of the lasers for them to actually be effective. But it did lead to one of my favorite movies of all time
So... here we are in 2012, and we still don't have laser guns or flying cars. Or laser guns on flying cars. I do expect the flying cars soon, but it looks like the closest we're going to have to laser guns for a while is laser sighting. Sure, you can put someone's eye out with it if they agree not to look away, and we can cut things with really big lasers, but they're not really portable at that level and need huge amounts of energy.
But let's go back to rayguns... actually, let's go back to that very first one: H.G. Wells' heat ray. The military rolled out the first example of the non-lethal Active Denial System in 2010.
There you have your fiction to reality, just not with lasers. But lasers still power the imagination, and militaries around the world are still working on laser-based weapons. There have been claims of ground-based lasers that are capable of taking down aircraft, but they require enormous power sources. Interestingly enough, other uses of lasers have stayed pretty confined to science, not science fiction; however, if we ever do make it out into space, I would expect the weaponized use of lasers to reach science fiction proportions almost immediately since there are no atmospheric conditions to deal with.