Because they still need to do the time (in prison) for the crime.
Otherwise, if you're illegal you can commit murder and the most that could happen is you get a free ride back to your home country.
Right now, if you're illegal and in prison you're deported at the end of your sentence. For federal prisons anyway. It would be a good start if they did this at the state level too.