Doctors wear White coats because they signify health and hygiene. White is desirable because they show the stains and perhaps indicates when you need to change clothes as soon as they are stained. Frequent changing gives a better outcome for the patient. This will ensure that Doctors maintain a clean and sterile environment all the time.
Wearing black robes by Lawyers and Judges dates back to 17th Century British practice. The black color is perceived as a symbol of dignity, honor, wisdom, and justice. As Lawyers and Judges have to keep up these values and maintain grace and dignity black is prescribed for them.
Black or White, they have a symbolic value which is called in the jargon of the Corporate Sector as the concept of Power dressing.