According to tradition, barristers wear black because they’re still in mourning for Queen Mary II, who died in 1694.
Or, properly speaking, they adopted black on Mary’s death at the wish of William III and have retained it as a convenient costume ever since.
Mary is most commonly cited; sometimes another Stuart queen is named. Sir Frederick Pollock, who served as Chief Baron of the Exchequer for more than 25 years, famously joked that the whole bar went into mourning in the time of Queen Anne (Mary’s younger sister) and never came out again.
He wrote, “I have always been told that formerly the Bar wore, in Court, coats, &c. of any colour under the gown, which also need not have been black; but that on the death of Queen Anne the Bar went into mourning, and since then every barrister has generally worn black.”