The black judicial robes date back in time hundreds, if not thousands of years. In medieval times, all educated people in the British isles, not just judges wore robes and these were customs descended from the Gaelic people who originally ruled Britain and Ireland. This custom differed from that of the Romans who wore togas.
The Gaelic elite wore robes with color signifying rank, black being the lowest rank, that of a docent, the lowest level of a professor. Later, when the Saxons invaded they eventually adopted some of the customs of the Gaels. The culmination of this was the founding of what is now known as Oxford University by King Alfred, the greatest of the Saxon kings. This tradition was preserved and developed at Oxford which affected the dress of all academics, including lawyers and justices.
Thomas More in his regalia typical of an Oxford Don, c. 1500
These patterns of dress also were influenced somewhat by Italian clerical styles. The main difference between the Italian styles and the Gaelic styles is that Italian robes are usually coats, opening in the front. The Gaelic robe either has no opening at all, just a hole the head is put through, or is divided at the back.
The custom of wearing wigs or perukes was a late development which originated in France in the 1700s and has no great antiquity at all.