The tradition of dressing up for Halloween most likely comes from the Medieval practices of "mumming" and "going a-souling," which historically took place on All Saints Day and All Souls Day. Mumming meant dressing up in costumes, singing, dancing, play-acting and making other general mischief. Souling meant going door to door offering prayers for the dead in exchange for treats. Current Halloween customs are an amalgamation of traditions from Celtic, various pagan and Roman traditions.
The tradition of trick or treating as it is known in America today was likely started by Irish immigrants to the country in the 1800s. By then the traditions of mumming and souling were more or less forgotten and unobserved back in Britain and Ireland. Trick or treating and general costuming were barely mentioned in American culture until after the 1930s. More than likely, the traditions of mumming and souling were somehow merged together in various festivities surrounding Halloween in America. Because the most common association with Halloween is that of honoring the dead, supernatural festivities became associated with the holiday. This eventually morphed into costume parties with partygoers dressing as various supernatural creatures. Halloween has long been a source of consternation for religious organizations, with many decrying it as a Satanic or evil holiday despite its partially Catholic roots.