Can the military keep me from enlisting for mental illness?
Yes, they can legally do this. Each military service (Army, Navy, Air force, Marine Corps, and Coast Guard) sets their own enlistment qualifications and its own minimum medical and mental health standards for enlistment.