"Memento mori" is a Latin phrase which means "remember that you will die." Its origins go back to classical Rome when it was the practice for victorious generals celebrating a public triumph to have a slave follow them and whisper "Respice post te! Hominem te esse memento!" ("Look around you and remember that you are only a man!") into the ear, as a reminder to remain humble in the face of transient success because all worldly achievements must eventually yield to death.
However, during classical antiquity, the original meaning of the phrase had been distorted into a sort of Roman version of YOLO (you only live once). It was associated with the Latin phrase "Carpe diem!" (Seize the Day) which exhorted people to live and be merry while they could, because life is transitory. As such it was more of an encouragement to hedonism and pleasure than an admonition.
The concept of memento mori was altered after and on account of the introduction of Christianity. Given Christianity's emphasis on judgment after death, memento mori became once again an admonition - this time not against vanity, but as a warning to live a good life because Death and the judgment that would follow were never far away.
During the Middle Ages and the Renaissance, it was fashionable among the higher classes to own a human skull, sometimes elaborately decorated with precious stones or gold, to remind the owner that he too would one day die. The Dance of Death is itself a sort of memento mori, acting as a reminder that death awaits us all.