Just like President Ford did with President Nixon, if Obama were to resign, the new President Biden would premptively pardon Barry for any and all crimes that he may have committed, before any trial could take place.
Timing would be key. We would need to impeach both the president and the vice president and then remove them simultaneously. Now that would be historic!
Of course, given the votes, we could remove Biden before allowing him to get a VP confirmed, thereby making Speaker Boehner (or hopefully a successor) President. But that would still allow President Biden time to pardon Obama.