In law school we were told that the term comes from being allowed to enter 'the bar' in an English courtroom (I assume that 'barrister' has the same derivation). From the 'bar' entry at link https://books.google.com/books?id=rpnjVDWGKGMC&pg=PA94&lpg :
'To be called to the bar. To be admitted a barrister. The bar is the partition separating the seats of the benchers from the rest of the hall. Students having attained a certain status used to be called from the body of the hall within the bar, to take part in the proceedings of the court. To disbar is to discard from the bar. Now, 'to be called within the bar' means to be appointed king's (or queen's) {counsel;} and to disbar means to expel a barrister from his profession.'
'To be called to the bar. To be admitted a barrister. The bar is the partition separating the seats of the benchers from the rest of the hall. Students having attained a certain status used to be called from the body of the hall within the bar, to take part in the proceedings of the court. To disbar is to discard from the bar. Now, 'to be called within the bar' means to be appointed king's (or queen's) {counsel;} and to disbar means to expel a barrister from his profession.'