The Midrash explains that the death penalty had previously been decreed against Nadav and Avihu at the time of Matan Torah. At that time, Nadav and Avihu, together with the elders, ascended Har Sinai to receive the revelation of the Shechinah. Upon experiencing this unique revelation, however, they derived personal pleasure from it and did not respond with proper reverence. They were all judged to be guilty by Hashem. Hashem refrained from meting out their punishment immediately. One reason suggested is that Hashem bestows prophecy only on one who is happy and at peace. Had a national tragedy such as the death of Nadav and Avihu occurred prior to Matan Torah, the Jews would have been incapable of experiencing Matan Torah in the appropriate manner which they did. Therefore, Hashem postponed their deaths until a later date.
We may question this. Why did Hashem mar the inauguration of the Mishkan? Is there not also a requirement for joy during this auspicious occasion? What difference is there between Matan Torah and Chanukas HaMishkan, when the Shechinah came to repose amidst Klal Yisrael? Horav Y. Feigelshtok, Shlita, responds that in order for Matan Torah to have occurred, the quintessence of joy must have pervaded, untainted by even the slightest blemish of sadness. Torah study is the most sublime endeavor. Through Torah study, the Jew has the privilege to indulge in Hashem’s greatest gift, the lifeblood of our people, the Torah. One who studies Torah with the appropriate attitude transcends pain, suffering, and frustration. His total immersion in Torah study liberates him from the vicissitudes of life and adds to his enduring happiness.