It is one of The Quran stories which has many lessons in morals.
Before talking about the story, we should talk about the people that the story told about them. The people are Bani ‘iisrayiyl
(Israelites) which are mentioned in Qur’an in Al-A‘rāf Sura. Those people who disobeyed Allah several times even one time they worshiped an ox as a god during the absence of the prophet Moussa for forty days. They argued prophets many times like when they disbelieved the death of the Pharaoh, so Allah showed his corpse. Add when they asked many questions about the cow that Allah ordered them to sacrifice.
(163) “And ask them about the town that was by the sea – when they transgressed in [the matter of] the sabbath – when their fish came to them openly on their sabbath day, and the day they had no sabbath they did not come to them. Thus did We give them trial because they were defiantly disobedient.”
By that Ayah Allah ordered Mohammed the prophet to tell the Jewish about the story happened in Bani ‘iisrayiyl and asked them to prove his right Islam religion.
Because of Bani ‘iisrayiyl rebellious nature, Allah punished them by forbidding them from sea fishing. Moreover and to test them, Allah made the fishes and whales spreading in the Saturdays, unlike the other days. So, one day someone of Bani ‘iisrayiyl put his fishing nets in the sea on the Friday, and took the nets on Sunday, then he cooked the fish. When the neighbors smelled the fish, they asked them, and he taught them the way. As a result, some of them continued of fishing during Saturdays.
Bani Israel Situation
Bani ‘iisrayiyl (Israelites) were divided into three groups; one of the disobedient people, the faithful advisers, and the uncaring believers. And it is worth to mention that the faithful advisers warned the Ashâb Al Sabt from God punishment, but the uncaring believer were neutral, but they asked the faithful one to stop advising them as it will be fruitless.
(164)” And when a community among them said, “Why do you advise [or warn] a people whom Allāh is [about] to destroy or to punish with a severe punishment?” they [the advisors] said, “To be absolved before your Lord and perhaps they may fear Him.”
While the disobedient was arrogant and persevered in their evils, and the words of the believers were not useful with them, the command of God came, and authorized the infliction of torment on them, so a strange torment befell them, stranger than the affliction and the first punishment which was the deprivation of fish, as God mutilated them and changed their forms from human to apes.
The Reward of the Believers
To be mentioned, that the two groups of believed people made a wall to be separated from Ashâb Al Sabt, since the believers were frightened from God punishment. One day, they missed Ashâb Al Sabt, and when they went to them, they shocked as they became monkeys. That punishment occurred just to Ashâb Al Sabt.
In contrast, it was not mentioned in the Quran anything about the third group which was neutral.
albayan.ae أصحاب السبت.. اللّعنة بعد المعصية
quranenc.com سورة الأعراف – Al-A‘rāf