Verse 51 refers to other incidents in the same story. When the Pharaoh had been drowned, the Israelites, according to one report, went back to Egypt, or, according to another, began to live somewhere else. Having at last found a peaceful existence, they now wished they could receive a Shari` ah, or a religious code of laws, from Allah which they should follow. Allah answered the prayer of Sayyidna Musa (علیہ السلام) and promised that if he came to the Mount Tur طور (Sinai) and devoted himself to worship for a month, he would receive a Divine Book. He gladly obeyed the Commandment, and was granted the Torah تورات . But he was ordered to continue to worship for ten days more, because he had broken his fast after a month and thus lost the special odour which rises from the mouth of a fasting person and which is very pleasant to Allah; so Allah commanded him to fast for ten additional days and regain that odour. Thus, Sayyidna Musa (علیہ السلام) completed forty days of total fasting and devotion. While he was on Mt. Sinai, something very odious happened to the Israelites. Among them there was a man called Samiriyy سامری . He fashioned the figure of a calf out of gold or silver, and put into it some of the dust which he had picked up from under the hooves of the horse of Jibra'il (the Archangel Gabriel علیہ السلام), at the time when the Pharaoh and his army had been drowned by the Archangel. The golden calf immediately acquired life. The ignorant among the Israelites were so impressed that they started worshipping it.
Verse 51 calls them "unjust" for having committed this sin, for 'injustice' lies in putting things in the improper places, and idolatory is essentially just that.
Allah then said, "Remember My favor on you when I forgave you for worshipping the calf." This happened after Musa went to the meeting place with his Lord at the end of that period which was forty days. These forty days were mentioned in Surat Al-A`raf, when Allah said,
(And We appointed for Musa thirty nights and added (to the period) ten (more)) (7:142).
It was said that these days were during the month of Dhul-Qa`dah plus the first ten days in Dhul-Hijjah, after the Children of Israel were delivered from Fir`awn and they safely crossed the sea. Allah's statement,
(And (remember) when We gave Musa the Scripture) means, the Tawrah,
(And the criterion) that is that which differentiates between truth and falsehood, guidance and deviation.
(So that you may be guided aright), after escaping the sea, as another Ayah in Surat Al-A`raf clearly stated,
(And indeed We gave Musa ـ after We had destroyed the generations of old ـ the Scripture (the Tawrah) as an enlightenment for mankind, and a guidance and a mercy, that they might remember (or receive admonition)) (28:43).