The play is based on the Roman Catholic premise that salvation is attained through penance and good deeds - one must atone for one's sins before dying in order to receive everlasting life and enter heaven.
In the play Everyman (which obviously refers to every human) is visited by Death to take him to heaven where he is to face judgement. Obviously, Everyman feels that he is not ready and seeks to take with him all that he has accrued on earth to stand witness for his virtues. But one by one, all his earthly possessions forsake him, even his kindred. He cannot take his beauty, strength or fellowship with him. Good Deeds does not have the strength to accompany him since he has been neglected.
When Everyman sees Confession, he agrees to take penance and punish himself with a scourge. After doing this, he is forgiven all his sins. The result is that Good Deeds is revitalized and strong enough to accompany him.
The moral is firstly that one cannot enter heaven with earthly goods when one dies - these have no value and are left behind. Secondly, only the good that one does can bear witness to one's grace at Judgement, and thirdly, one should do penance and seek forgiveness for one's sins before entering the Kingdom of Heaven.