'When the people saw that Moses was so long in coming down from the mountain, they gathered around Aaron and said, “Come, make us gods who will go before us. As for this fellow Moses who brought us up out of Egypt, we don’t know what has happened to him.” ' Exodus 32:1
Moses had been up on the mountain for 6 days and the Israelites had already turned from God and even Aaron had allowed so much corruption to come into the community.
Aaron took the people's jewelry and made an idol from the gold. The people worshiped the idol and then participated in sexual immorality. God was so angry that He told Moses that He would kill them all for their sins, but Moses asked God to spare them so that he could do try to fix the situation.
Can prayers cause God to change His mind?
Sometimes God adjusts His plans in response to our requests or actions. We see this in some areas of scripture (Nu 14:11-23; Am 7:1-7; Jnh 3:1-10). Interpersonal relationships are often complex. We alter our responses according to God's, and God will sometimes do the same for us. There are many things that will not change just because we want them to. I love the way my NIV Quest Study Bible puts it;
"There are decrees and promises he has made that do not change. He kept His covenant with the forefathers of the Israelites (Dt 7:7-8) and He keeps His new covenant with those who believe in Jesus (Jn 6:37-40, 44). God wants us to live out His will obediently. He has predetermined ways He expects us to respond, but He has made us capable of resisting Him (Ps 143:10; 1Th 5:16-18; Heb 10:35-39; 2Pe 3:9). These aspects of God's will work together. While it is not possible for us to fully understand how they work together, we know that God is ultimately in control."
When Moses returned from the mountain where he was convening with God, he was extremely angry with Aaron, who blamed the people for all that had happened, and with the people who had become so corrupt in only a matter of days. Moses called forward the faithful people of God and told them to kill all the sinful people who had rebelled against God.
'Then he said to them, “This is what the Lord , the God of Israel, says: ‘Each man strap a sword to his side. Go back and forth through the camp from one end to the other, each killing his brother and friend and neighbor.’ ” ' Exodus 32:27
I feel the biggest lesson here is that we are called to put God above everything and everyone else, even our own families. God's will comes first.
' “Anyone who loves their father or mother more than me is not worthy of me; anyone who loves their son or daughter more than me is not worthy of me. ' Matthew 10:37
Moses returned to the mountain to speak with God some more and told God of the great sins the people had committed.
'But now, please forgive their sin—but if not, then blot me out of the book you have written.” ' Exodus 32:32
Moses asked for forgiveness for the people, and God decided that He would "blot out" these sinners from His book. The best way I can think to explain God's book is to think about Santa's naughty and nice list. The good children on the nice list are rewarded for their good behavior, and the children on the naughty list get coal. Likewise, the faithful children of God are rewarded with Heaven and the naughty list, those who are "blotted out" get damnation.
God tells Moses to lead His people to where He has commanded them and at the right time He will punish them. Then the Lord set a plague on the people as punishment for their sins against Him.