Of course no can have the same idea about where our now version of trick-or-treat comes from. So here is a collaboration of what I have read.
Trick-or-treating is done on Halloween night. Halloween is the contraction of All Hallow's Eve. Christians believe at certain times of the year, the realm separating earth from Purgatory, heaven, and even hell becomes more thin, and the souls in Purgatory (ghosts) and demons can be more readily seen. Thus the tradition of Halloween costumes owes as much, if not more, to Christian belief as to Celtic tradition.