"For their calamity will rise suddenly, and who knows the ruin that comes from both of them"
This is the Hebrew word ed, which means calamity, destruction, punishment, disaster, trouble, misfortune.
The idea is that everyone will have disaster and calamity come into their lives. These are both natural and God-directed. It is how you prepare for them and whether you put yourself in harm’s way by your actions and behaviors. In this particular case, Solomon is pointing out that those who change positions and lifestyle are basically playing chicken with a freight train. Calamity is coming to certain groups because of their sins, risks, and lifestyle. And the person who jumps from one group to another and from one type of sin to another will surely jump into one group just as calamity is about to hit. They decided to run to the other side of the tracks just as the train was pulling into the station. Bad idea.
Now it is important to notice that Solomon does not say that calamity will come quickly upon them. It may take a long time before a sudden calamity will engulf them.
This is the Hebrew word senayim, which means two. This word has created great controversy in that it is not exactly clear what it refers to. Some believe it refers to the double calamities of disasters and death. Others believe that it points out the two forms of evil mentioned in verse 21 – dishonor to the Lord and dishonor to the king. It would seem that this second explanation has the most support and makes the most sense.
In other words, Solomon is saying that dishonoring God brings calamity and ruin and rebellion from government leaders and also brings its own type of ruin and disasters. Both of these are separate problems. There are law-abiding people who disregard God. There are believers who refuse to submit to the governing authorities. Both are unwise courses of action unless the government is specifically forcing you to break God's law.
It is too late to wait until you are caught by disaster or justice to begin honoring God or civil leaders.