In the 1840s, Halloween was brought to the United States by Irish immigrants. But trick-or-treating was not part of the Irish tradition and came from the European custom of souling. On All Souls Day (November 2), people would go door to door asking for “soul cakes,” which was bread and currents. At each door, the person receiving the cake would promise to pray for the souls of deceased relatives of the people who gave them the cakes.
The actual phrase "trick or treat" was not used until the early 1940s when they were used as the title of a poem in the Saturday Evening Post.
Where did carved pumpkins fit into all of this? Actually, this custom also developed with the Celts who passed down a legend about a mean old man named Jack who died and went to hell. He met the Devil and was given a piece of burning coal and cast away. Jack put the coal into a turnip and used this as a lantern. When the Irish first came to America and saw pumpkins for the first time, they began using them instead of a turnip as their “jack-o-lantern!”
Today, the traditions continue and children still look forward to the annual trek for treats. Unfortunately, in many areas, parents are reluctant to allow their children to go door-to-door. Communities have set up parties at malls and other locations to enable kids to show off their costumes and gather goodies without fear of safety.
With the advent of a certain wizard, one particularly modern idea is to have a themed Halloween where kids enjoy dressing up in Harry Potter costumes.