The customary honorific in the United States used to identify someone who has a J.D. (doctor of laws a.k.a. "Juris Doctor"), which is a recent invention, or an L.L.B. (bachelor of laws), the more common historical name for the same degree, if that person is also admitted to the practice of law, is to state someone's name followed by the honorific "esquire". Hence, "Andrew Oh-Willeke, Esquire" or "Andrew Oh-Willeke, Esq."
Strictly speaking "Esquire" should generally only be used by a third person referring to a lawyer, and not by the lawyer himself or herself, but sometimes lawyers use the title reflexively anyway to clarify to someone to whom the lawyer is writing that the author is a lawyer.
Esquire is a quasi-aristocratic rank in England immediately below that of a knight (the lowest aristocratic rank and not always hereditary) and above that of gentleman, that is not a true aristocrat as it is not a hereditary rank and does not have a well defined meaning other than that someone is "upper class".
This vague modern English meaning was crystalized to have a more specific meaning in the U.S. (per the previous Wikipedia link):
In the United Kingdom, Esquire historically was a title of respect
accorded to men of higher social rank, above the rank of gentleman and
below the rank of knight. It later came to be used as a general
courtesy title for any man in a formal setting, usually as a suffix to
his name, as in "John Smith, Esq.", with no precise significance. In
the United Kingdom today, it is still commonly used as a written style
of address in formal or professional correspondence.[4][5] In certain
formal contexts, it remains an indication of a social status that is
recognised in the formal Order of Precedence.[6]
In the United States, Esquire is mostly used to denote a lawyer; in a
departure from traditional use, it is used irrespective of gender. In
letters, a lawyer is customarily addressed by adding the suffix
Esquire (abbreviated Esq.), preceded by a comma, after the lawyer's
full name.[7] An exception to this would be the American magazine
Esquire which, as a publication for men rather than lawyers, uses the
term in the original British sense.
As of 1894, when the term still had a formal definition in England, it was defined as follows:
- The younger sons of peers and their eldest sons.
- The eldest sons of knights and their eldest sons.
- The chiefs of ancient families are esquires by prescription.
- Esquires by creation or office. Such the heralds and serjeants at arms and some others, who are constituted esquires by receiving a
collar of SS. Judges and other officers of state, justices of the
peace, and the higher naval and military officers are designated
esquires in their patents or commissions. Doctors in the several
faculties, and barristers at law, are considered as esquires, or equal
to esquires. None, however, of these offices or degrees convey
gentility to the posterity of their holders.
- The last kind of esquires are those of knights of the bath; each knight appoints two to attend upon him at his installation and at
coronations.
The use of the term "Esquire" treads some fine lines, because the United States Constitution categorically forbids the creation of true titles of nobility. Article I, Section 9 of the U.S. Constitution states in the petinent part: "No Title of Nobility shall be granted by the United States" and Article II, Section 10 of the U.S. Constitution states in the pertinent part: "No state shall . . . grant any Title of Nobility."
The fact that many lawyers do not have a J.D. and instead have an L.L.B, and more importantly, that no lawyers had a J.D. at the time that customary forms of address for lawyers were formulated (the legal profession in the United States was formalized in the late 1800s and the first law school was established at Harvard in 1870), is part of the reason that the title "Dr." is not used.
The degree "Juris Doctor" was not widely used until the 1960s. The first law school to grant a J.D., the University of Chicago Law School, was founded in 1902 and wouldn't have had a graduate with a J.D. until 1905 or so. As explained in the Wikipedia article "Juris Doctor":
The University of Chicago Law School was the first to offer it.[84]
While approval was still pending at Harvard, the degree was introduced
at many other law schools including at the law schools at NYU,
Berkeley, Michigan and Stanford. Because of tradition, and concerns
about less prominent universities implementing a J.D. program,
prominent eastern law schools like those of Harvard, Yale and Columbia
refused to implement the degree. Indeed, pressure from them led almost
every law school (except at the University of Chicago and other law
schools in Illinois) to abandon the J.D. and readopt the LL.B. as the
first law degree by the 1930s.[85]
It was only after 1962 that a new push—this time begun at
less-prominent law schools—successfully led to the universal adoption
of the J.D. as the first law degree. Student and alumni support were
key in the LL.B.-to-J.D. change, and even the most prominent schools
were convinced to make the change: Columbia and Harvard in 1969, and
Yale, last, in 1971.[86] Nonetheless, the LL.B. at Yale retained the
didactical changes of the "practitioners courses" of 1826 and was very
different from the LL.B. in common law countries other than
Canada.[66]
As noted in the answers and comments to this question, many countries with a different historical experience do address lawyers as "Dr." and in Japan, lawyers (or at least the Japanese equivalent of barristers) are addressed "Sensei" which literally means "teacher" or perhaps "professor" but is a term of respect used for all learned professionals (including doctors).
It is improper and often considered fraudulent to use "Esquire" if you have a J.D. or L.L.B degree, but are not admitted to the practice of law. People in that position can write: "Andrew Oh-Willeke, J.D.", although even that puts you on thin ice as it might be used to give the impression that someone is admitted to the practice of law, when they are not.
I was a professor for a while, and many of my peers who were not lawyers used the title "Dr." as they had PhDs. It was not considered proper, even then, for either me or a peer who also had a J.D., to go by the title "Dr." and instead I was addressed "Professor Oh-Willeke" or "Mr. Oh-Willeke".
All of these useages are, of course, arbitrary, but they are also well established. As noted in the citations made by Pat W. in that answer, ethics opinions have not reached a consensus on the ethics of a lawyer using the title "Dr." since the J.D. came into wide use, although the "Council" statement referenced in that answer applies primarily to make clear that a J.D. is equivalent to a PhD for the narrow purpose of being qualified to be a university professor, and not for the purpose of title of address.