Overall meaning :
Allah Almighty instructs His Prophet, Muhammad, may Allah bless him and grant him peace, to ask the Jews of his time—by way of rebuke—about the story of the town which was by the sea and how its Jewish inhabitants had broken the Sabbath and disobeyed His command to them to faithfully observe the Sabbath, devote themselves to His worship, venerate that day and abstain from fishing on it. He instructs him to ask them how they transgressed His limits when fish would come to them in abundance and openly on the day of their Sabbath, but they would not come to them on other days. Thus did Allah try them for their disobedience and for transgressing His bounds.
And mention to them, Muhammad, the time when a group of people from that town said to those who admonished the transgressors among them, 'Why do you admonish the Sabbath-breakers whom Allah is going to destroy or to afflict with a severe punishment?’ They replied, 'We do so in order to be free from blame before your Lord, who commands us to enjoin good and forbid evil, and so that these transgressors might also become mindful of Him and avoid what He forbids.’ However, when the transgressors completely ignored the warnings they had been given them and stubbornly refused to accept their advice, Allah rescued those who forbade evil, but He seized those who wronged themselves by disobeying Him with a grievous punishment because they were given to transgression and disobedience.
Then, when they transgressed all prohibitions and scornfully persisted in fishing on the Sabbath, Allah said to them, 'Be apes, despised and contemptible.’