Mr Obama dropped in on talks between the British politician and US National Security Advisor Susan Green for around 25 minutes, a Labour aide said.
Their exchanges - said to have touched on a range of international issues - were described by one who was in the room as "very warm and friendly".
His arrival, at a time of a number of international crises, will have come as a relief to Mr Miliband's team - which now includes Mr Obama's former election guru David Axelrod.
Such visits are seen as important for opposition leaders ahead of a general election as they seek to present an image as a global player.
A spokesperson for Mr Miliband said: "The Leader of the Opposition and the President discussed a range of issues, including the situation in Ukraine, Gaza, and the future of the European Union.
"The pair also discussed the economy, climate change & the approaching referendum in Scotland. The meeting lasted around 25 minutes."
Asked if it was simply a photo opportunity, Mr Miliband told ITV News: "As somebody who wants to be the prime minister in less than 10 months' time, it's important I'm here talking to key figures in the administration about the many pressing issues that our country faces and indeed the world faces."
He denied that his relationship with the White House would be a cooler one than seen in the past - despite his success in effectively scuppering Mr Obama's planned military intervention in Syria last year by leading a Commons vote against it.
"It's about a close relationship with the United States, it's also about knowing where our national interest lies," he said, responding to comparisons with ex-Labour PM Tony Blair's closeness to president George Bush over the Iraq war in 2003.
"On the Syria vote, I thought it wasn't right for Britain to take that action in relation to chemical weapons. I thought it wasn't the last resort, I didn't think the case had been proved; it would make the situation better not worse.
"I think that's what the British public will expect of me, hard-headed, not withdrawing from the rest of the world, but knowing that my responsibility as prime minister will be to send their sons and daughters, the sons and daughters of our country into conflict, and to only do that, when I know it is absolutely necessary."
He denied having to "plead" with the White House to secure the meeting or of risking looking "desperate" to voters.
"No, I think what it is about is saying there are huge problems that the world faces, whether it's the tragic downing of the Malaysian airliner, with the loss of significant British life, or the problems in the Middle East, and those problems, the solutions to those problems, go through the United States - and go through Britain working with the United States, and that's why I'm here."
He said he had not been able to meet with his brother David - who quit as an MP and took a job in the US after losing out on the party leadership to his sibling - because he was "on a family vacation some distance from here".
But he insisted they talk regularly.
"We talk, I mean we talk a lot, and he's doing a great job actually helping refugees across the world, a really really important job and a job we talk about a lot."