To control rowdiness, a wooden bar was built across early courtrooms to separate the judge, lawyers, and other principle players from the riffraff seated in the public area.
That bar, first used in the sixteenth century, is also where the English word barrister came from, for the lawyer who argues the case in court.
When someone has “passed the bar” or has been “called to the bar,” it means he or she is now allowed into the closed-off area.