Pastor Joseph Abrahamson has a running project of refuting the notion that Christian holidays derived from pagan festivals. You have got to read what he says about the history of Halloween.
He points out, for example, that since days were considered to begin when the sun goes down on the previous day, Halloween is the “eve” of All Hallows; that is, All Saints’ Day, one of the oldest Christian holidays that had no connections whatsoever with any pagan observances. So just as Christmas Eve is actually the beginning of Christmas day (so that it is quite legitimate to open presents on that day), Halloween is the beginning of All Saints’ Day.
Pastor Abrahamson also shoots down the common myth, particularly propagated by Neopagans and Wiccans, that Halloween had its origins in the Celtic festival of “Samhain.” In reality, Samhein was started in Ireland in the 10th century. All Saints’ Day, with its eve, were first celebrated in Syria in 397 A.D.Trick or Treating comes from the custom of beggars making the rounds for almsgiving, which was associated with All Saints’ Day as well as the other major Christian holidays: Christmas, Easter, and Pentecost.
Jack-o-Lanterns first showed up in America in the 1800s.
For more details about the origins of Halloween, read Pastor Abrahamson’s article: Hallowe’en: A short history.