What's the biggest contributing factor mentally as an illness that often enables drug addiction?

Many factors. When it comes to drug use, the causes are likely multifactorial. Being genetically predisposed, being raised by addicted parents, learning to use substances to cope, not learning to cope with feelings. Etc, etc. The important thing is really not what caused the problem, but getting help to fix it.
Genetics mostly. It is not unusual for bipolar disorders, adhd disorders and depressive disorders to become both drug and alcohol abusers. All of those disorders have strong genetic predispositions. That applies to obsessive compulsive disorders as well.
Genetics. Only a small percentage of patients who take prescriptin pain killers such as vicodin, Percocet or Oxycontin get addicted. Patients have individual brain chemistries, genetically determined, that control the amount of Dopamine that is released at their opiate receptors when activated by pain medications, and the way the drugs are metabolized. A partial explanation, but not an excuse for addiction.
DEPENDS on how you. Want to look at it. There is NO single mental health problem that the majority of people with addiction develop, but there are a number of problems that markedly increase the odds that that person will develop addiction, like major depressive disorder, anxiety disorders, bipolar disorder, and particularly post-traumatic stress disorder, or really any history of early life repeated trauma.