A person who is usually quiet or obedient will retaliate or revolt if pushed too far. The phrase refers to the prediction of a drastic change in a situation due to the action of a person or thing usually taken lightly or regarded as powerless or insignificant.
He has been enduring his boss's tantrums silently for a long time, but beware, the worm will turn.
"The worm will turn" is a saying that means even someone who is weak or submissive will eventually stand up for themselves if they are treated badly for long enough. It's like saying that even a small and harmless creature like a worm will defend itself when in danger. You can use this expression when talking about someone who is being mistreated or bullied for a long time, but eventually, they will stand up for themselves and fight back.