Actually Andy has other options if he didn't want to go to the jail because of his high intelligence. He felt guilt that his wife's death was due to their quarrel so he was willing to be in jail for 19 years even though he was innocent so that his guilt will be reduced. However, his student Tom was killed by the warden who made use of his talent to launder money because Tom knew the fact that he was innocent. He suddenly came to realise that he was here to sin not to end others' life indirectly so he ran away from this flashpoint.
in fact by Andy's intelligence, if he had not wanted to be put to prison, he should have had other options. He just felt regretful that his wife death was due to their quarrel so he was willing to stay 19 years' imprisonment with innocence, so that his sin in heart can be cleansed; at this time, knowing his innocence, his "student" Tom was murdered by prison warden who had been made use of Andy to wash money. He suddenly thought he could stay no more in the place of trouble--that he was here to expiate sin, how could he forfeit other's life indirectly?
In fact with Andy IQ, if at that time don't want to put in prison, should also have a choice. He just left owe and repentant, he thought his wife's death was due to their quarrel, so willing to innocent in prison, after 19 years gone life, his heart to sweep away the sin; This time his "student" Tom because he was innocent of that has been using Andy money laundering warden of kill, he suddenly think the flashpoint he cannot go on-he is to sin, how can and indirectly conspired to the lives of others?