This morning, Funny Or Die released an episode of Zach Galifianakis's web series Between Two Ferns featuring Barack Obama as the special guest. Variety has the story on how this ended up happening.
Basically, the White House wanted to get young Americans to sign up for health insurance before a March 31st headline. Last summer, Obama attended a meeting with White House advisers and a bunch of movie/TV people about how to use Hollywood to spread the word about health care reform. Funny Or Die President of Production Mike Farah was at said meeting and pitched the idea of Obama doing Between Two Ferns there, but didn't discuss it with Obama directly. Senior Obama adviser Valerie Jarrett met with Farah in Los Angeles in the fall and talked about it with him then, confirming Obama's appearance months later and things got rolling from there.
UPDATE: Vulture has an in-depth interview with Between Two Ferns director Scott Aukerman, also describing how the whole thing came together. Here's an excerpt:
Zach and I didn’t really think that anything would come of it. I mean, we’d been hearing rumors that President Obama has perhaps been interested in doing the show for quite a few years now and it never really panned out. And then months and months went by and nothing really happened with it. So, approximately three weeks ago, we heard that if it was ever going to happen, it was going to be now, so we should get ready and prep.
It really came around in a week. We heard he was interested, and Zach and I prepped and wrote up a treatment for them to look at, with what we wanted to do with the video and how we wanted to approach it. For me, the most important thing was that it didn’t come across as an advertisement. I really wanted it to be a funny, normal "Between Two Ferns" video. And the great part about it was that the White House was very accommodating of that and didn’t want to get in the way of our process. They didn’t want it to be just any kind of ad; they knew that it had to be funny and it had to be what we normally do for anyone to actually watch it. So, to their credit, they actually stayed out of our way with it. But yeah, within a week Zach and I had pitched what we wanted to do, they accepted it, and we flew out to the White House [laughs] and filmed it.