This is a question that has never come up so we don't know for sure. If we are lucky, we may never have to find out, because election results and criminal trial results will reach some permutation that prevents this question from arising.
ItBut, until someone elected to be President takes office (if he is not the incumbent), the answer is easy. He stays in prison. If you are in prison for a crime, neither federal law nor state law provides that you are entitled to be released because you have been elected President.
After January 20, it would present something of a constitutional crisis not contemplated when the U.S. Constitution was drafted, because they couldn't imagine their electors choosing someone convicted of a felony, and imminently about to be incarcerated for it, being elected in the first place.
If you are in prison for a crime, neither federal law nor state law provides that you are entitled to be released because you have been elected President.
No one in the federal government has the power to pardon someone or commute the sentence of someone sentenced to prison for a state crime.
While it has never been tested historically and there is scholarly disagreement on the point, the majority view among legal scholars and professionals is that the President does not have the power to pardon or commute his own federal criminal conviction or sentence. See also here and here and here for other discussions on Politics.SE and Law.SE of that question.
The most obvious possibilities, after January 20, would be that the President would carry out his duties from prison, or would be impeached, or would be deemed disabled under the 25th Amendment allowing his Vice President to take over for the duration of his incarceration.