To practice law, you need a license issued by a state or territory, including the District of Columbia. To get the license, you have to be trained (usually in an ABA-approved law school, but not always), then you take a bar exam for several days, have your background checked (for criminal or other problems), and pay some money to the state. After that, in most states, you renew the license annually by paying some more money and taking a few continuing education classes. You can lose your license if you misbehave, but that’s very rare.
In theory, everyone with a law license is competent to practice any kind of law — specialization in the law exists to some extent, but it’s nothing like specialization by doctors. Also in theory, anyone without the right license is incompetent and cannot practice law in that jurisdiction — doing so would be a crime in most states. That applies even to lawyers who are licensed elsewhere, no matter how good and experienced they are. The least experienced, most incompetent lawyer with a New York law license is, in theory, more competent than the most experienced, most intelligent lawyer from anywhere else, even a former judge, for example.
While the license is supposed to protect the public from incompetence, there’s really no guarantee it will serve that function. (Even lawyers who have lost malpractice cases continue to practice — the bars rarely step in. We won a malpractice case against a lawyer who went on to become a federal judge.) The bars generally ignore most competence-related complaints, and those about fees for example, plus most sanctions are just slaps on the wrist unless the lawyer gets caught committing a crime, and has already been found guilty. So what licenses really do is restrict competition and drive up the cost of lawyers, especially in some states where the bars take extra steps to make it difficult, or expensive, for out of state lawyers to visit or even take the state bar. (While professional courtesy used to allow the occasional “pro hac vice” appearance out of state, many states now require one to pay a substantial fee and jump through various hoops before they will extend this courtesy.)
These rules about licensing are enforced most often, from what I’ve seen, against solo lawyers, not against large law firms. Larger law firms, many of whom describe themselves as “national” firms, not tethered to a particular office or state, use lawyers from all over the country (even other countries) despite these rules. They might have a lawyer on the matter who is admitted in the right state, but, if not, they may use a local counsel to cover for them — signing the pleadings and accompanying them to court. According to the federal judge quoted below, they probably should not be paid at all.