The original Jack-o-Lanterns were made from turnips and beets. They come from an Irish legend about Stingy Jack, who tricked the Devil and kept him hostage using crosses, promising to release the Devil if he would not take his soul to Hell with him. The Devil agreed, and when Stingy Jack died, he could not enter Heaven, nor could he stay in Hell due to the promise he had extracted from the Devil. The Devil gave Stingy Jack an ember from the fires of Hell to light his way, and Jack placed it in a large turnip or rutabaga to create a makeshift lantern. When the Irish immigrated to North America, they brought their traditions with them and began using the cheaper and more readily-available pumpkins for their Jack-o-Lanterns instead.
Sources: History, pumpkinnook blog