Lots of options, one of which is "none"
There are a lot of spells which could be relevant in a courtroom. Spells could compel the truth (Zone of Truth), or read the mind of a suspect (Detect Thoughts), or even ask for guidance from a higher power (Contact Other Plane, or Commune).
The problem with any and all of these options is that most of them can be fabricated or countered. The spell Glibness, for example, will permit someone to appear to be telling the truth, even to divination magic. And the spell Mind Blank will make your thoughts unreadable, even to a wish spell. And any number of illusion spells could make it appear that a deity provided certain misleading guidance.
As such, it's possible that magic in your world would be viewed similarly to hearsay in ours: it's so easy to fabricate, that it's inadmissible as evidence except in very rare cases (like in our current justice system, where hearsay is admissible if you're speaking on behalf of a deceased person, who clearly can't speak for themselves).
In that case, by far the most useful spell to the judicial system would be Antimagic Field. A courtroom might be kept perpetually under the effect of one while in session, to ensure that no one attempts to magically manipulate the evidence or outcome of the trial.