If the doc says he's at low risk of re-offending, or that treatment could be effective, that might be helpful at sentencing, if the case gets to that point. (It could also be helpful if he were trying to get released on bond.)
Maybe there's also potential to argue that his mental illnesses made him less responsible for his behavior, although mental illness can also be grounds to increase a sentence in order to protect the public from future crimes of the defendant.
I'm not sure if there are other potential uses in mind for the doc's testimony.
• ( https link ) 18 U.S. Code § 3553. Imposition of a sentence