In Parashat Vayeilekh, the fourth aliyah seems to be out of place. The beginning of the Parasha is about Moshe preparing B'nei Yisrael to enter Israel without him, and telling them that Yehoshua will be their new leader. All of a sudden, Moshe introduces a new commandment to them, the commandant of Hakhel. In Devarim 31:10-13, Moshe describes this mitzvah. Every seventh year on Succot, all of B'nei Yisrael should go to the place that Hashem will choose and listen to the Torah so that they will fear Hashem.
There are a few glaring questions: why does Moshe randomly tell B'nei Yisrael this new Mitzvah when they are about to enter Israel? What does Sehmitah have to do with this? How will reading the Torah make us fear Hashem?
In order to fully understand this problem, we need to answer these questions in reverse order. Why will hearing the Torah make B'nei Yisrael fear Hashem? Because all of B'nei Yisrael gathered together should remind us of Har Sinai. The events at Har Sinai created our relationship with Hashem, which involves fear. There’s only one problem with this answer. At Har Sinai, there was thunder and lightning so of course we were scared!
This is where Shemitah comes in. To an ordinary person, Shemitah sounds very strange. We should take a whole year to not work the fields? How are we going to make money or get food! Fulfilling the commandment of Shemitah requires the utmost fear of and reliance on Hashem. Hakhel is essentially recreating this historic moment to renew our relationship with Hashem. So when B'nei Yisrael are gathered all together and hear the Torah at the end of the Shemitah year, they have two big reminders of why we should fear Hashem while they hear the Torah. Obviously this gathering won’t be as dramatic as Har Sinai itself, but it will have a similar outcome.
Now to the last and most troubling question: why did Moshe mention this now just before his death? Moshe mentioned this now because B'nei Yisrael’s lives were about to be transformed by losing Moshe, who was the living reminder of their connection to Hashem. Once gone, B'nei Yisrael might not take their relationship with Hashem as seriously. This Mitzvah is actually the perfect exit speech for Moshe since it was meant to remind B'nei Yisrael of Har Sinai. With this taste of the most important moment in Jewish History, B'nei Yisrael would maintain their relationship with Hashem. Moshe needed to tell them this Mitzvah now so that they stay connected in the future when he would no longer be with them. Another crucial factor of this Mitzvah is to continue it in the future for the coming generations to get that same taste of Har Sinai as inspiration to have a special relationship with Hashem and fulfill his commandments.
I heard this Dvar Torah from Ami Silver who works for Aleph Beta.