Auto insurance companies will be wary of selling you coverage if you have a medical issue that makes it dangerous for you to get behind the wheel. In fact, you are required to volunteer the information to your insurance company if you have such a condition. Even if you don't do it, your auto insurance company can still learn of your medical condition via other channels, for example:
Your Doctor's Report
Medical providers are required to report to the Department of Motor Vehicles (DMV) all new cases of diagnosed medical conditions that make driving dangerous. It is your doctor's prerogative to decide whether the condition you are suffering from will endanger you or other road users if you continue driving with it. For example, all conditions that cause frequent bouts of fainting should be reported.
Police Officer's Report
Apart from your doctors, any police officer that suspects you of a medical condition that makes driving dangerous may also report your condition to the DMV. This can easily happen if you are flagged down at a DUI checkpoint or by officers on patrol. In some cases, they may even suspect you of DUI. When such officers learn of your medical condition, expect them to include it in the report. The DMV will also be notified, and you will be required to stop driving until your medical issue is sorted out.
Your Family Members
Your family members may not be under any obligation to report your medical conditions to the DMV, but they can and should. Some motorists don't want to accept that they are too sick to drive, especially if the illness is age-related. In that case, a concerned family member may take it upon themselves to disclose of the issue to the DMV.
Lastly, the DMV and your insurance company may also learn of your medical issues if you are involved in an accident and the investigations reveal your role in it. Maybe you had momentarily fainted at a traffic stop and failed to stop in time, or you have a condition that affects your reaction time. Whatever the cause of the accident, expect the relevant bodies to hear about it if it turns out that you should not be driving with your medical condition.
In short, there are many ways in which your insurer can know of your dangerous medical condition, but it is best if you do it on your own. Don't think the world is against you if your family, insurance carrier, doctor, and the DMV all don't want you to drive; they are just looking out for you and other road users.