Halloween started as a pagan ritual among the Druids. They called it Samhain (pronounced Sah-ween) and they believed it was a time that supernatural forces could move freely in our mortal world.
When the Romans came to the Celtic lands, it was easier to put a spin on the old customs than to abolish them, so they melded Roman celebrations and Christian interpretations into the pagan customs. October 31 became the day that people were to remember the dead and make offerings to them.
People would wear costumes to try to pass themselves off as evil spirits, in an effort to fool the real evil spirits who were, supposedly, wandering about.
Vagrants would take advantage of superstitious people by going door-to-door, begging for "soul cakes". For each treat you gave them, they would promise to say a prayer on your behalf.