Visiting a doctor does take ID if you have insurance. Also, by federal law, picking up any prescriptions that a doctor writes requires ID, certainly at least for narcotic prescriptions.
Doctors' offices generally make some effort to verify the identity of anyone not paying up front. Some insist on scanning a government-issued photo ID. Others are more flexible.
Regulations for dispensing controlled substances vary from state to state. As of 2013, only 24 states required pharmacists to verify identity.[1] Many of those regulations apply only in certain circumstances, don't specifically require government-issued photo ID, have fallback procedures, or allow the pharmacist to dispense the medication without ID if withholding it would harm the patient. Florida recently passed a law that says it's good enough if the pharmacist recognizes the patient.[2]