A mental illness may prevent ordination if the illness would prevent the candidate from adequately performing his ministerial duties.
Code of Canon Law (CIC) states, “The following are irregular for receiving orders: (1) a person who labors under some form of amentia or other psychic illness due to which, after experts have been consulted, he is judged unqualified to fulfill the ministry properly…” (CIC 1041)