Eugene V. Debs received 919,799 votes while he was in prison. What would happen if someone won the presidency and were a federal prisoner?
Throughout the entire Constitution, there is no mention of restriction on the basis of being a felon. There'd likely be no reason to restrict him. This, of course, ignoring the whole "he's in prison and would have trouble campaigning", and the issues he'd have filing bureaucratic paperwork to run and on finances (his staff could, theoretically take care of those, though he'd have to know they were good staff members).
Now, let's say he was elected President by some miracle. You're going to have a bunch of people saying things like "He's not a citizen, he's a felon", but these things don't have a stated basis in the Constitution, and I don't think Congress could do much besides amend the Constitution to change it. Let's say he gets past all that, and inauguration rolls around. The Constitution only says he has to take an oath of office; he doesn't have to do it outside the prison, in theory. LBJ was sworn in on Air Force One after Kennedy was shot. So he gets sworn in...then what? Well, he's still technically a prisoner, so if he's being kept prisoner and not released yet for being the President, the Constitution does give the President the power to pardon federal criminals. Wilson considered, if I remember right, pardoning Debs during his second term (but my memory is hazy there). In theory, Debs could pardon himself, be a free man, and walk around freely as he did all the work a President would have to.
But I've gotta say, it would be pretty funny to see them try to swear him in. "Sorry, swearing-in has to wait, it's not visiting hours yet!"
I'd pay to see that!
I had briefly removed this question because at first I thought it fell within the alternate history category better suited for /r/historicalwhatif. But this is less a "what if" question, and more a question about the legal fallout of electing a president currently in prison, which can potentially be answered without speculation about an altered past.