He can request protective custody, and a lot of prison systems will put sex offenders in separate areas by default, but the word is that "if the guys in the general population want to get at you, they can". Also, if the guards dont like you for any reason, they will put you where other inmates can mess with you.
That being said, there are a bunch of sex offenders in prison, and all of them dont get messed with. The best rule is "mind your business and do your time". If his lawyer can get him to serve his time in county jail, or, better yet, work-release, he will have a lot smoother time. There is a BIG difference between most county jails and state or federal prison. Most county inmates are their for a few months, then they either get released or get sent to prison. They dont really have time to establish a territory or pecking order. Since your ex is over 40, he will get put with older inmates in most county jails. That would be better for him. The young inmates in any county jail are 98% of the troublemakers.
The bottom line is, he would be much better staying for as short a time in possible in state prison. The folks I've known who have been there always say "you dont wanna know what goes on there".
A really good friend of mine from college who wound up getting sentenced to a year for selling marijuana said sort of the same thing.
He served his time in the county jail. He was made a trustee very quickly (probably b/c he had no priors and a college degree) and said it wasn't actually that bad. The trustees lived in a seperate area, and he said everyone was mainly concerned with staying out of trouble and getting out as quickly as possible.