It seems a bit ironic that Andy becomes a more compassionate and more feeling human being once he is inside prison. His wife, before her death, would complain to him that he was a "closed book." While the start of his time in prison saw him embodying some of the same elements, over time, he becomes more of a sensitive and feeling person, who is able to express these elements to both himself and the people around him. Being able to prepare the taxes and then become the financial adviser for the prison staff, as previously mentioned, helps to build the library and help other inmates earn degrees and allow them to better themselves.
When the prison guards realize how useful Andy is to them in giving them advice about money, investments and taxes, he is allowed much more freedom and way more "perks" than the other prisoners. The guards and the prisoners begin to trust Andy. Andy begins to take advantage of this trust by doing things for the other prisoners while they are in prison.
He writes to the state government and convinces them to send books to the library. He helps the prisoners get their high school equivalency diplomas so that when they are paroled, they will have a better chance to find work. This helps achieve justice because they can better themselves when they are paroled. He also arranges to play an opera over the loud speaker so that the prisoners can enjoy a short period of escape with the beautiful music. Many of the things he does for the other prisoners land him in "solitary" but he doesn't seem to care. This makes him even more popular with the other prisoners.
When Andy escapes from prison, he makes sure to send the evidence of the Warden Norton's illegal money-laundering scheme to the press. When the authorities come to the prison to arrest Norton, he commits suicide. This is probably the biggest thing Andy did to achieve justice for the inmates because those that are still in prison will no longer have to suffer under the injustices of Norton's control.