“And G-d said to Moshe, ‘sculpt for yourself two stone tablets, like the first ones, and I will write on the tablets the words that were on the first tablets” (Sh’mos 34:1). These instructions were given at the end of the second set of 40 days, telling Moshe to carve out new tablets to bring with him when he ascended Mt. Sinai for the third set of 40 days. During this third set of 40 days, Moshe was taught, and then recited (see page 2 of www.aishdas.org/ta/5766/kiSisa.pdf) the “Thirteen Divine Attributes” of G-d in order to attain forgiveness for the sin of the golden calf. However, if G-d had already agreed to give the nation a second set of Luchos, hadn’t He already forgiven them? True, we didn’t get the second Luchos until Yom Kippur (the 40th day of third set of 40 days), but the forgiveness they represent (and which we try to recreate every year on Yom Kippur) seems to have occurred 40 days earlier!
The commandment to keep the Sabbath (31:12-17) is the last thing taught before the sin of the golden calf is related, and follows the commandments regarding the building of the Mishkan. [It was also taught to the nation right before they were commanded to build the Mishkan (35:2-3), but that was done in order to teach them that they were not allowed to desecrate the Sabbath when building it (see Rashi).] The proximity of the commandment to keep the Sabbath to the initial commandment to build the Mishkan teaches us that the same types of activities necessary to build the Mishkan are the “work” prohibited on the Sabbath (see Baal HaTurim). But what about its proximity to the sin of the golden calf? What does that teach us?
There are several aspects of forgiveness described in the narrative of the golden calf, and it’s not always easy to keep track of what was forgiven and when. Some of the commentaries compound this confusion by applying the concept of the Torah not always being taught chronologically, although the reason they apply it here is to try to explain the timing of the various aspects of forgiveness. Many commentaries keep the chronology intact, though, and a straightforward reading of the verses strongly supports this. In order to try to put each aspect of forgiveness in context, an understanding of the three sets of 40 days is warranted.
The first set of 40 days began shortly after the public revelation (which was on the 6th or 7th of Sivan), and ended on the 17th of Tamuz, when Moshe descended from Mt Sinai (where he had spent the prior 40 days). Upon seeing the sin of the golden calf, he broke the (first set of) Luchos that G-d had given him at the end of the 40 days, and started to repair the damage done by the sin of the golden calf. The second set of 40 days began when Moshe went back to G-d to try to attain forgiveness for it (32:31), and ended at the end of the month of Av. These 40 days are described (D’varim 9:18, see Rashi) as having all been spent by Moshe begging for forgiveness, although there is some discussion as to whether he spent these 40 days atop Mt. Sinai non-stop (as he did for the first and third sets), or whether he ascended and descended from Mt Sinai on a regular basis, taking care of things in the camp as well, or whether he stayed in the camp the entire time, spending much of it in his tent (which he had moved outside the camp, see Sh’mos 33:7-11), where he did his beseeching of G-d to forgive the nation (see N’tziv on 33:12). The third set of 40 days started on Rosh Chodesh Elul, and ended on Yom Kippur with Moshe having attained complete forgiveness.
The first “forgiveness” attained, that G-d wouldn’t destroy the nation , was stated during the narrative of the first 40 days ( 32:14) . Not wiping them out addressed Moshe’s concern about what the Egyptians would say (32:12), but didn’t necessarily mean they would remain G-d’s chosen nation; they could still be around without having a special relationship with G-d anymore. [G-d agreeing not to destroy them right then and there gave Moshe time to try to fix things, and subsequently gain additional levels of forgiveness (see Ramban on 32:12).] After Moshe destroyed the golden calf (32:20), and had those who sinned publicly (after being warned not to) executed (32:27-28, see Rashi on 32:20 and 32:35), Moshe went back to G-d to ask for forgiveness (32:31). G-d indicated that the nation could resume their trip to the Promised Land (32:34, 33:1-3), albeit without His presence dwelling within them. This wasn’t enough for Moshe, who insisted that G-d Himself lead them to the Promised Land, not just an angel (33:12-16). G-d acquiesced to this too (33:17), as well as to Moshe’s request that G-d no longer rest His presence among other nations (see Rashi). Since the purpose of His not doing so was to differentiate between the “chosen” nation and the other nations (see Rashi on 33:16), this obviously also means that G-d would rest His presence amongst Moshe’s nation. And since all this occurred before Moshe ascended Mt. Sinai for the third set of 40 days, what was left for Moshe to ask for?
The commandment to keep the Sabbath had already been taught to the nation. It was included in the “Ten Commandments” (20:8), and was taught even earlier than that (16:23; see also Rashi on 15:25). Yet, after teaching Moshe about the Mishkan, G-d told Moshe to “speak to the Children of Israel, saying, ‘nevertheless, my Sabbaths shall you keep, for it is a sign between Me and you for all your generations, to know that I am G-d Who sanctifies you” (31:13). Reiterating the need to keep the Sabbath here has multiple purposes — not only because of some of the details that were added (such as the death penalty, see 31:14), but because of its relevance to the Mishkan (as previously mentioned). What about the expression “to know that I am G-d Who sanctifies you”? Obviously, there are many things that it could be teaching us (as Chazal darshen), but Rashi understands the “knowledge” as the other nations knowing; they will now know that it is G-d Who sanctifies us. How will they know this? “Because G-d made the heaven and the earth in six says, and rested on the seventh day ” (31:17). When the Children of Israel keep the Sabbath, they are not only testifying that G-d created the world, but that the deity they are worshipping is the One Who created the world. Idol worshippers didn’t believe they were worshipping the Creator, but that the Creator had given other deities dominion over things, who were therefore worth worshipping. The Creator, on the other hand, is “the Uppermost Deity” (see B’reishis 14:19-20), respected by idol worshippers too (see Yonah 1:9-10; even though the sailors all cried out to their deities, upon hearing that Yonah worshipped the “G-d of the heavens, Who made the sea and the dry land” they became “greatly afraid,” recognizing that the Creator is far above the deities they worshipped). By keeping the Sabbath, it would be clear that the nation traveling through the desert with a divine cloud protecting them worships the Creator, not just some run-of-the-mill deity. It would therefore seem that one of the prerequisites for G-d resting His presence in the Mishkan (or on the nation as a whole) is that it be clear to all that the nation He was dwelling amongst worshipped the Creator of the world.
Unfortunately, by making a golden calf and worshipping it, this was all undone. How could any outsider think this nation worshipped the Creator if they had made a golden calf and treated it as a deity? Any anger G-d would have normally had was magnified because of the implications of this sin. Not only did they disobey G-d; not only did they allow some to worship another deity, but one of the main purposes of taking the Children of Israel out of Egypt, that others should “know” about G-d (see 7;17, 8:18, 9:14, 9:29), was now undermined. Even after G-d agreed not to destroy them and allowed them to proceed towards the Promised Land, and even to have His presence rest upon their leader (Moshe) and not on the leader of any other nation (thereby distinguishing them from the others), G-d was not yet willing to rest His presence on the entire nation. He would lead them, with His “cloud pillar” in front as they traveled, but not dwell amongst them, with His divine clouds protecting them and His “cloud pillar” resting on the Mishkan. Moshe could carve a second set of Luchos to signify that there was still a covenant between G-d and the Children of Israel, but that covenant no longer included His dwelling amongst them. They could worship Him, and He would fulfill His promise to their forefathers. He would even accompany them on their trip to the Promised Land. But there would be no Mishkan.
This was the status of the relationship after the second set of 40 days. Then Moshe took advantage of learning the powerful prayer of the “Thirteen Divine Attributes,” and started praying. Day after day. For 40 days. Until finally, on the 40th day, G-d completely forgave the nation, and agreed to let them build a Mishkan for Him to dwell in. The covenant, which the Luchos represented, now took on added significance. True, there would need to be an official vehicle for repairing the relationship if/when it weakened again (the offerings brought in the Mishkan, coupled with sincere repentance), but G-d’s response after Moshe’s 40 days of saying the “Thirteen Divine Attributes” was “behold I am enacting a covenant — before your entire nation (and not just you) I will perform wonders,” wonders that had heretofore “never existed,” not “in all the land” nor “in any nation” (34:10). G-d would rest His presence on the nation (and only this nation), and they could now build the Mishkan for Him to dwell in.