(And indeed you knew). This Ayah means, O Jews! Remember that Allah sent His torment on the village that disobeyed Him and broke their pledge and their covenant to observe the sanctity of the Sabbath. They began using deceitful means to avoid honoring the Sabbath by placing nets, ropes and artificial pools of water for the purpose of fishing before the Sabbath. When the fish came in abundance on Saturday as usual, they were caught in the ropes and nets for the rest of Saturday. During the night, the Jews collected the fish after the Sabbath ended. When they did that, Allah changed them from humans into monkeys, the animals having the form closest to humans. Their evil deeds and deceit appeared lawful on the surface, but they were in reality wicked. This is why their punishment was compatible with their crime. This story is explained in detail in Surat Al-A`raf, where Allah said (7:163),
This episode belongs to the time of Sayyidna Dawud (David (علیہ السلام Allah had appointed Saturday as the Sabt سبت ، or the sacred day, for the Israelites; it was specially set apart for prayers and worship, and hence fishing was prohibited on this day. But these people lived on the sea-shore, and were very fond of fish. Al-Qurtubi says that the Israelites, at first, invented all sorts of clever pretences for catching fish on Saturday, and gradually started doing so openly. There now grew a division amongst them on this point. On the one hand were these transgressors, and, on the other, some scholars and pious men who tried to dissuade them from such disobedience. When the former paid no heed to them, the latter broke away altogether from the sinners, and began to live in a separate part of the town. One day they felt no sound was coming from the other part of the town. Growing curious, they went there and found that all the transgressors had been changed into apes. Qatadah says that the young ones had become apes, and the old ones swine. The apes could recognize their relatives and friends, and would approach them weeping out of remorse, and seeking their sympathy and help. Then all of them died after three days.
A covenant was made with Moses’ people that they would faithfully carry out the divine teachings given to them in the form of the Ten Commandments. The Talmud tells how, at this time, God turned a mountain upside down, holding it above them and told them either to accept the teachings of the Torah, or be destroyed there and then. The same is the case with everyone who embraces true faith. To have faith is to make a contract with God that one will live and die in accordance with His will. What a grave pledge this is. On the one hand there is man—a tiny, helpless speck in God’s world—and on the other, God, whose might upholds the universe. If man keeps his word, he will be granted God’s eternal blessings. But if he turns away from his commitment, he is in grave danger of being cast into hell-fire, never to emerge again. Everyone who believes in God should go through the same experience as Moses’ people. Everyone who binds himself to the contract of faith should live in the fear of breaking his religious vows, thereby bringing catastrophe down upon himself. Sometimes those entrusted with the law of God go astray by contradicting it in practice, while finding words to make it appear that they are following it to the letter. The Israelites, for instance, were commanded to keep holy the Sabbath day, and refrain from worldly pursuits on that day. But they violated it and went about their work on the Sabbath as on any other day. Furthermore, they sought to justify their actions and made out that what they were doing conformed to the will of God. This audacity incurred God’s displeasure and they were turned into apes. Whenever one turns against the law of God, one puts oneself on a par with animals who follow no code of ethics. Those who play games with divine law, should fear being deprived of their human dignity, and being brought down to the level of animals.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.