Originally, jack-o-lanterns were carved out of turnips, whose waxy skin and gaunt form offer much more of an undead panache than the relatively jolly pumpkin. The origin of this, as befits the holiday, comes from a scary story. In 17th-century Ireland, there once lived a fellow named Stingy Jack, who, true to his name, was a bit of a son of a bitch. One day, Jack met the Devil in a pub (this is an Irish story) and decided to trick him. Playing up on his frugal nature, Jack convinced Satan to transform himself into a coin in order to pay for their drinks. However, instead of plopping the demonic coin on the counter, Jack decided to pocket it right next to a silver cross. Weakened by the divine symbol, the Devil could not escape and had to make a deal with Stingy Jack, promising to leave his soul alone for 10 years. We can only assume the Devil had been drinking since early that afternoon and was no match for Jack's deviousness.
When Old Nick reappeared to exact vengeance 10 years later, Stingy Jack once again tricked him by making him climb an apple tree that had a cross carved into its bark (the Devil was either drunk again or an eight-year-old boy). Again, the same deal was struck, but this time Jack died before the 10 years were up. When he arrived in Heaven, God told him in no uncertain terms that a man who spent his life deceiving everyone, up to and including the Father of Lies, was not welcome in paradise. For obvious reasons, the Devil wouldn't let him into Hell either. So Jack was cursed to roam the Earth in eternal darkness, with a carved turnip lantern as his only source of light, because flashlights hadn't been invented yet.
Now let's all celebrate with a cool glass of turnip juice.
Eventually, the tale of the wandering fiend became a mainstay in folklore, with children excitingly peering into the night, fearing that they would see the tiny light of Jack of the Lantern (or Jack o' Lantern, as is the Gaelic way to put it). Soon, Jack became part of the festival of Samhain, the Irish and Scottish equivalent to Halloween, and people would celebrate by carving their own turnip lanterns. When the Scots and Irish started emigrating to the Americas, they took their spooky tradition with them, but traded in their traditional turnip for pumpkins, which were native to America and more easily obtained. Turnip lanterns are still handy if you run out of candy and want to make sure no kid comes within 100 yards of your front door, though.