Not necessarily. Or at least not necessarily in the “traditional” way, meaning an formal appearance before a judge in a courtroom, with lawyers flanking you and your Ex like you may see on television.
In Ontario, even if your divorce is on consent (meaning you and your Ex both actively agree to it, and to the manner in which you want to settle your legal issues) or if it is uncontested (meaning your Ex does not object to the divorce), you obtain a divorce decree by making an application to he court. This is a formal administrative step that involves certain forms to be filled out, and documents to be provided to and filed with the court offices. Your lawyer can assist with this.
However, in cases where there are no contentious issues, you can negotiate a mutually-acceptable outcome by essentially arranging for your divorce “over the counter” – i.e. by way of an administrative process that does not involve you or your respective lawyers formally going before a judge in court.