Allah tells us that another sign of His great power and dominion is the fact that He has subjugated the sea so that ships may sail in it by His command, so they sail in the sea like mountains. This was the view of Mujahid, Al-Hasan, As-Suddi and Ad-Dahhak. In other words, these ships on the sea are like mountains on land.
إِن يَشَأْ يُسْكِنِ الرِّيحَ
(If He wills, He causes the wind to cease,) means, the winds that cause the ships to travel on the sea. If He willed, He could cause the winds to cease, then the ships would not move and would remain still, neither coming nor going, staying where they are on the surface of the water.
وَمَا أَصَابَكُم مِّن مُّصِيبَةٍ فَبِمَا كَسَبَتْ أَيْدِيكُمْ وَيَعْفُو عَن كَثِيرٍ (And whatever hardship befalls you is because of what your own hands have committed, while He overlooks many [ of your faults ].... 42:30) means exactly the same. Sayyidna Hasan ؓ has narrated that when this verse was revealed, the Holy Prophet ﷺ said "I swear by the Being Who holds my life, that anyone who gets scratched by a piece of wood, or his nerve shivers or his step falters is all due to his sins, and Allah Ta’ ala does not punish for every sin, rather the number of sins He overlooks far exceeds those for which any punishment is given." Maulana Ashraf Ali Thanavi (رح) has stated that just as the physical hardships and tortures befall due to sins, the inner ailments are also caused by sins. One sin committed by a person becomes the cause for getting involved in other sins. Hafiz Ibn Qayyim has written in his book Ad-Dawa-'ush- Shafi that one prompt punishment of a sin is that one gets involved in other sins; similarly the prompt reward of a virtuous deed is that it attracts another virtue. Baidawi and others have stated that this verse is specifically meant for those people who are likely to commit sins. The hardships and the troubles that befall prophets who are innocent of sins, children who have not reached the age of puberty and mad persons, who do not commit any sin, are not covered by this verse. There are other reasons for them, for example, they are upgraded in their rewards. And in reality a man cannot fathom the depths of wisdom behind them. (Allah knows best).
The present world has been created and made subject to the law of cause and effect. So, if an individual is beset by adversity, it is clearly due to his own shortcomings. However, it sometimes happens that a man commits a sin, yet remains unaffected by its baneful outcome. All these events happen in the world in order that man should learn a lesson from them. When he sees that whatever people receive is commensurate with their deeds, he should infer that, in the Hereafter also, everybody will be rewarded according to his deeds. Similarly, when he sees that somebody has been guilty of a lapse, yet goes unpunished, he should learn the lesson that God is Merciful and Gracious, and that if a man turns towards Him, He, in His Mercy, will save him from the consequences of his shortcomings. If a man’s Faith is deep, he comes to the point of discerning a picture of the Hereafter in the events of this world.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.