The name as we use it is a Scottish shortening of "allhallow-even" ("even" meaning "evening") and dates from 1745.
"Allhallow-even" was itself a variation of "All Hallows’ eve," which dates from the mid-16th century and marked the last night of the year in the old Celtic calendar. The Irish, being a superstitious people, claimed "Old Year's Night," as it was also known on the calendar, was a time for witches. In addition, the ancient Gaels of Ireland believed that on the night of October 31 (the end of the annual harvest), the boundary between the living and the dead was dissolved. The dead would rise from their graves to damage crops, spread illness, and wreak havoc.
Irish and Scottish immigrants brought versions of their Halloween traditions to the US in the nineteenth century. These included jack-o'-lanterns, which originated in Europe and were first carved not from pumpkins, but turnips and rutabagas. The Celts believed the head was the most powerful part of the body, and so created "heads" out of root vegetables to ward off evil. Pumpkins were used in the United States because they were larger and more plentiful.