The use of a television show as reference for a court case can be helpful for a judge to relate to the members of the court. Sometimes it helps to find common ground with others by using a television reference. It does not take away from the serious nature of the court.
While South Park may not be the most professional or reliable of sources to quote in a court of law, judges certainly have the right to express their freedom of speech, just like the rest of us. Pop culture influences just about everyone, judges too. Perhaps the judge was making a comment on the defendant in front of him, whose to know.
Judges should not be trying to introduce levity, or pop culture references into court proceedings. We rely on them to be the arbiters of our justice system, therefore, they should take their jobs extremely seriously. There is no room in a court for jokes or humor. Judges should just stick to the law, and issuing sentences that are appropriate.
Judges are supposed to cite legal precedents when making court rulings, instead of using pop culture references. A judge should not reference a line from a television show when making his ruling on a court case. Television shows have no legal precedent, and should not have any bearing on the justice system.