Trask has Barnabas walled up and really enjoys taunting him. Julia is extremely suspicious of Trask and Gerard but has no proof that they have done anything.
Gerard lies to Daphne about having seen Joanna's spirit the night before and manipulates her into having Quentin write a note that will further incriminate him. And Trask is there to confiscate it. Yawn.
Exactly what help would Barnabas have been in the trial? Beyond being a character witness, he can't provide any testimony that would help Quentin.