Halloween (sometimes written Hallowe'en) is a holiday celebrated on 31 October. Its origins are usually associated with an ancient Celtic holiday called the festival of Samhain. This harvest festival was a celebration in thanks for a bountiful harvest; at the time it arose, good harvests were chancey things, and the quality of the harvest had much to do with the community's chances of surviving the coming harsh winter. The holiday came to be associated with the death of the year, and from there, with the deaths of people. In addition, the Druids commonly offered sacrifices to spirits to assure that the next year's crop would be bountiful. From this came the notion that the day was one where the barriers between the spirit world and the real world were the thinnest -- permitting spirits benevolent and baneful to roam freely. To scare the baneful spirits away, people dressed in costumes and carved faces in turnips and pumpkins. At some point, it was linked to the similar Church holiday All Saints Day, also called All Hallows Even, which eventually was contracted to Hallowe'en. By the 20th century, the holiday had become largely secular, but many of the customs remained a part of it, including much of the death and spirit imagery.
In 2267, alien explorers Korob and Sylvia, attempting to understand our galaxy, constructed a castle, garbed themselves like wizard and sorceress, and used other imagery that suggested the holiday of Halloween to the Kirk and McCoy. Spock later theorized that the aliens attempted to telepathically scan the landing party, and "missed", somehow retrieving information from the subconscious fears of the explorers. (TOS: "Catspaw")