Would a 5-year prison sentence totally ruin one's academic career?
A five year prison sentence would damage an academic career in at least two major ways.  The obvious way it would damage it is from the possible stain on a person's record.  In the U.S., at least, being a convicted felon can be very difficult to recover from, no matter what the crime, due to general societal prejudice.  Add to that the fact that most crimes indicate either dishonesty or being a threat to others, and you've got a serious problem.  It does, however, strongly depend on the crime.  For example, if the crime is an "honest crime" that derives from ones intellectual inclinations (e.g., the notorious example of Timothy Leary, the sad case of Aaron Swartz, or the youthful recklessness of Robert Morris) then it may be "forgiven" from an academic point of view.

The other, perhaps less obvious, source of career damage is from the interruption in ongoing work.  Typically, any working scientist has a number of simultaneous multi-year projects at different stages: preliminary work, proposal, execution, publication.  Each of these fuels the others, e.g., papers from more mature projects help support proposals for new projects, pieces of ongoing work in project execution include preliminary work that leads to new proposals, etc.  With any major career gap, this "pipeline" can empty, and there is often difficulty in restarting it.  This can be a significant problem even for academics who take family leave; a multi-year gap for prison would be much bigger to overcome.  Either, however, can be overcome with time and help from supportive colleagues.