On the Wikipedia page for Halloween Costumes it says:
> An early reference to wearing costumes at Halloween comes from Scotland in 1585.
Looking at the external links on the page I found something that sort of explains this.
> As the centuries wore on, people began dressing like these dreadful creatures, performing antics in exchange for food and drink. This practice is called mumming, from which the practice of trick-or-treating evolved.
This seems to be why we do it. In Samhain (the Celtic pagan ritual from which a large portion of Halloween tradition is derived), people would dress up. So yes, the tradition does come from the pagan holidays that it is based on.