"These are the laws that you must set before [the Israelites]: If you buy a Hebrew slave, he shall serve for six years, but in the seventh year, he is to be set free without liability."
The slave who works for six years is a hint to one who learns the Mishnah, which consists of Six Orders. Learning the Mishnah can be called necessary but ungrateful labor, because it is only a preparation for future study of the Talmud and Kabbalah. One cannot decide the final law from it, nor does one know the various situations in which a particular Mishna is applicable.
The “six-year slave” is also a hint to a soul that was part of the Cosmic Man (Zeir Anpin, the spiritual entity comprising all souls), but then, due the soul's ruining the six attributes – Kindness, Judgment, Beauty, Victory, Splendor, Foundation – it had to come down into this world. Working for six years represents the soul working on each of the aspects of the world, and correcting every one of them.
But if the slaves refuses to leave his owner - that is, if the soul refuses to uplift itself and work on improving itself - then the master brings it to judgment and takes it to the door to make a hole in the slave's ear and keeps the soul in the cycle of reincarnations. The soul is destined to be reborn again and again, repeating its own mistakes.
Still, the soul of this Jewish slave has connection to holiness – to the source where it came from. Therefore, its efforts, even unwilling, are finally rewarded – and that is why the Jewish slave goes out to freedom in the Jubilee year. It may seem like an eternity – and that is what the Torah has actually said, “the slaves serves his master forever.” But this “forever” is not to be taken literally. Later on, describing the Jubelee year, the Torah says that “every man returns to his family.”
Art: Bartolome Esteban Murillo - Return of the Prodigal Son