Maybe the environmental charity was visiting a courtroom because environmental conscientiousness sometimes involves engaging with government processes through the courts, and a courtroom visit would make that abstraction more concrete.
Or maybe the environmental charity has an at-risk youth program component, and someone thought it would be a good idea to confront teens with some of the undesirable reality of getting into crime.
In either case, the judge might or might not have been in the loop on that. They might've just been in default mode, where they see bad and troubled behavior every day, all day.
It's not really that unusual. Every student in my district (thousands) visited their local courthouses in Civics class in 10th grade.
>Why did the judge think "Scared Straight" trauma was appropriate under the circumstances?
Power tripping.