I've never heard of such a thing... including a prayer for lawyers! There's nothing to stop anyone saying a prayer in the hope that it will help them in their profession, whatever it is. I don't think this "prayer" has any standing in Halacha (Jewish religious law).
In contrast, one is supposed to recite a blessing on seeing certain natural phenomena, such as a rainbow, or trees in blossom for the first time in the year, but that is a religious requirement. To the best of my knowledge, there is no such religious requirement for members of professions to say a prayer.
My guess is that it's simply a nice thing to hang as decoration in one's office, and it would certainly be appropriate for judges as well. In fact, reading the text, it's more approprate for judges than for lawyers. The quotations are all biblical, and there were of course judges in biblical times but there were no lawyers!