The Setup:
Miles O'Brien must suffer every season. This season he was convicted of espionage and sentenced to prison. For 20 years he is kept in his cell with another prisoner. He is routinely starved and one night kills his cellmate, fighting over food. He is then released from prison. But the whole 20 year sentence was a simulation compressed into a few hours. There's no way to remove the memories. He then has to reintegrate into society, while trying to deal with the 20 years of suffering he went through in his mind. Eventually, he is suicidal and is talked down by Dr. Bashir.
The whole set up was dependant on having him spend that time in a horrible prison, but at the same time it always seemed strange that a society that was able to do this would still then chose to have the prison experience be a completely terrible experience with no thought of rehabilitation.