Twitter is written word, so in the UK at least it's legally classed as published material, the same as newspapers, magazines, official reports, business or personal letters, or in fact any written material destined for a third party. It's subject to various publishing laws, including the laws of libel (civil not criminal), Contempt of Court by publication, and potentially hate speech and public order laws too.
That said, Twitter and Facebook are often ignored by the law in practice, because they're not treated as reliable sources of information or bona fide newsgatherers.
The exceptions tend to be where posts are seen as causing serious offence or distress to the general public, and are therefore public disorder. Someone was jailed for insensitive comments relating to a child's murder, and someone else was jailed for provocative and insensitive (he claims they were political) comments about several British soldiers killed in Afghanistan.
Speculation about forthcoming or ongoing court cases via social media could well land you in trouble for Contempt of Court, as it could cause serious prejudice to the case. People do it a lot, and judges tend to tell juries to ignore the comments, but there are prosecutions from time to time.