Es geht (it goes) ihm (for him) schlecht (badly)--literal translation.
Think of the english saying "how's it going?" b/c it is the equivalent of "Wie gehts."
However in english one would usually say "things are going badly" or "shit's not good" (for a colloquial saying.) It seems important, when translating, to not always give a literal word for word translation. Instead, say what is meant in the way one would say it in English--one would not usually say "He is bad" in english. One would say either "he's not feeling well" or "things are bad for him right now" or perhaps "he misbehaves" or "he has behavioral problems"--if 'bad' is to mean not behaving correctly. However, in German, if we were saying an individual was behaving badly-I think-the accusative would be used, not the dative--as we would be attributing properties to an agent rather than describing the effect of actions on an agent (action being "bad going" for the the agent "him.")
But I do think some explanation of when, and why, to use "krank" rather than "schlecht" is in order. When I think "unwell" I think of physical illness specifically. Whereas 'not good' could mean anything from money to spousal problems. P.s. trying to contribute more to the community while working on the dative concept. pls correct any mistakes/misunderstandings. Hope this helps someone.
UPDATE: this doesn't necessarily explain why schlecht=ill, but it does shed some light on complaining and describing bad feelings in German--it is both funny and informative: http://yourdailygerman.wordpress.com/2014/03/25/german-bad-mood-vocabulary/#more-5855
"Wie gehts." ist tatsächlich Wie geht es. 'gehts' ist eine Kontraktion ohne Apostroph. Z.B. Ich wills ist "Ich will es"
*Think of the english saying "how's it going?" b/c it is the equivalent of "Wie gehts." *
Actually 'Wie gehts', as you have it should be 'Wie geht's'. Geht's is a contraction, as in the English "can't' for "cannot". Geht's is short for Geht Es. Wie geht's means "How Goes it"
It is an accusative pronoun and the feeling is reflective of him. Whereas Er is a normal subject pronoun. English speakers aren't taught such specific grammar principles. Hopefully a linguist or a native speaker comes along and can explain it better. My explanation is just what I was able to glean from my German professor's recent lecture.
Another correct solution: He is unwell.
Warum nicht "Er ist nicht gesund", Oder, "Er ist krank". Vielleicht "He's doing badly" würde auch gut tun.