I think people should apply for their medical license when they know they will need it. In some states, residents need only registration or limited license (sometimes called training permit). In other states, you need a regular medical license.
If you need a regular medical license for residency, you might as well apply as early as possible, such as immediately after internship or immediately after PGY-2 (depending on minimum requirements needed to get a license.) I think in a few states, you will need to get a license by the PGY-3 year. If so, why wait until the last minute and risk some kind of delay?
If one has a lot of family members in one state, they might consider getting a license soon after meeting the requirements. This is because the more popular states often try to make it hard for people to get licenses. Some states will grant you a license by mail, but others might make you appear before them if you had even a frivolous malpractice suit where you won. If so, getting a license as a resident with little record is easier than if you have been practicing.
Where are the difficult states? I heard NC is hard for optometry. For MD's (not this AMD or OMD stuff!), I heard it's FL, CA, TX, etc.