I worked with a doctor this past summer who goes to the detention center once a week to diagnose and treat any illnesses. As far as I know, it wasn't part of his job, and I don't believe he was paid for it. . . Just sort of a volunteer role. . . And he didn't do any "counseling" when we were there. . . just doctoring
Licensed clinical psychologists and licensed clinical social workers and unlicensed counselors (college grads with degrees in special ed, or education or psychology) tend to do that type of work in detention centers. Physicians are too "costly" to be used in that role.
As a physician, there isn't really much you can do in a juvinile setting. Nurses take care of the majority of it, and only severe/chronic cases may be referred to a state hospital. I am not 100% sure, but that's what I've heard from my friends who have actually interned there, who are all psychology graduate students, not med students.