In the epigraph to his short story "Ligeia," Poe quotes the philosopher and clergyman Joseph Glanvill (1836-1880) as follows:
And the will therein lieth, which dieth not. Who knoweth the mysteries of the will, with its vigor? For God is but a great will pervading all things by nature of its intentness. Man doth not yield himself to the angels, not unto death utterly, save only through the weakness of his feeble will.
Poe was obsessed by death, especially by the fear of death, as can be seen in so many of his poems and stories. In "The Masque of the Red Death" he seems to be symbolzing the universal human fear of death and the many ways by which people try to avoid--not dying--but facing the fact of dying. With Poe this fear seems to have been heightened by his loss of faith in traditional religious beliefs, a phenomena which was becoming widespread in the Western world with the incursions of science.
"The Masque of the Red Death" seems to be intended to depict allegorically people's attempts to avoid facing the terrible fact that death will claim all of them and take away everything they own and everything they love. The refugees seal themselves up in a fortress and indulge in pleasure-seeking, with all sorts of sounds and spectacles intended primarily to distract them from thinking about the fact that everyone is dying all around them. But it is futile. Death is inescapable. He appears among them without having been impeded in the slightest by the walls and gates and claims all of them. Their luxury and revelry was all pointless and meaningless. There is no escape. The story is popular because readers easily understand the meaning behind the metaphors.