The “bar” in Law, isn’t just the name of the exam. It refers to the physical gated wall in a courtroom dividing the lawyers and judges from the general viewing public. “Passing the bar” gains you admittance to work on the other side of the wall.
“In this courtroom, the bar is represented by a physical barrier (with swinging gate doors), separating the benches reserved for spectators from the judge’s bench and lawyers’ tables
In law, the bar is the legal profession as an institution. The term is a metonym for the line (or “bar”) that separates the parts of a courtroom reserved for spectators and those reserved for participants in a trial such as lawyers.
The origin of the term
bar is from the barring furniture dividing a medieval European courtroom, similar to the origin of the term bank for the bench-like location of financial transactions in medieval Europe. In the USA, Europe and many other countries referring to the law traditions of Europe, the area in front of the barrage is restricted to participants in the trial: the judge or judges, other court officials, the jury (if any), the lawyers for each party, the parties to the case, and witnesses giving testimony. The area behind the bar is open to the public.
This restriction is enforced in nearly all courts. In most courts, the bar is represented by a physical partition: a railing or barrier that serves as a bar.”
Wikipedia.