I didn't know I would go to jail for freedom of speech
But she didn’t go to jail for exercising her freedom of speech. She went to jail for cursing at a judge, behavior that isn’t covered by freedom of speech.
For the same reason that you can’t walk into a theatre and yell “fire!,” you can’t walk into a courtroom and yell “asshole!” Our speech is always subject to regulations of time, place and manner. It could hardly be otherwise.