You are conflating the right to carry out a business with the right to free speech. There are many reasons for licensing a business - sufficient liability insurance - self dealing etc.
None of which has anything specifically to do with doctors, nor are they to my knowledge typically even required of a business that sells e.g. fashion advice.