The short answer:
Halloween was taken from the old pagan holiday to honor the passing of loved ones known as Samhain (sow-een or sah-een). It was the last day of the pagan year, and with the new year came the honoring of those who had passed. The Christian religions, in an effort to convert pagans used the day after as a day to revere their passed Saints: it is known as All Saint's Day. That made the night before 'Hallowed Eve', and it eventually shortened to Hallowe'en.
The pagans believe that the spirits of their dearly departed roamed the earth at the time, when the veil between the two worlds was most thin. They carved turnips and placed candles in them to light the way upon the earthly plane. They placed food and drink on their doorsteps to feed the spirits.
The Christians eventually began wearing masks in an attempt to frighten the spirits away; children would play pranks and adults would soon give them treats to ensure that havoc was not played on their home.