It would be possible, theoretically , to get a law degree in prison if one had access to ABA-approved classes. I believe there is at least one approved source available on line. (St Thomas n Florida.) Certainly, it could be easier to get a law degree upon release to study law as well as possible even if formal education is not available.
However, after you get a law degree you need to take the bar exam to become a lawyer. That would have to wait until after release. Given my personal experience with lawyers, I'd say a criminal background is a plus. The ABA, however has it's own take on that. A felony conviction might be a complication.