The US president also urged Britons to vote to stay part of the European Union if they are given a say in the in/out referendum promised by David Cameron.
Speaking during a press conference with Cameron at the G7 summit Belgium on Thursday, Obama said it was up to the people of Scotland how to vote in September's referendum, but indicated he did not want to see the UK break-up.
"The UK has been an extraordinary partner to us. From the outside at least it looks like things have worked pretty well and we obviously have a deep interest in making sure one of the closest allies that we will ever have remains a strong, robust, united and effective partner," he said. Obama added: "Ultimately these are decisions to be made by folks there."
Asked whether he thought the UK should vote to quit the EU, Obama said he thought British voters would make the "right decision" and choose to stay in.
"With respect to the EU, we share a strategic vision with Great Britain on a whole range of international issues and so it's always encouraging for us to know that Great Britain has a seat at the table in the larger European project," he said.
"I think in light of the events that we are going to be commemorating tomorrow, it's important to recall that it was the steadfastness of Great Britain that in part allows us to be here in Brussels in the seat of a unified and extraordinarily prosperous Europe.
"It's hard for me to imagine that project going well in the absence of Great Britain and I think it's also hard for me to imagine that it would be advantageous for Great Britain to be excluded from political decisions that have an enormous impact on its economic and political life.
He added: "This is why we have elections, and we'll see the arguments made, and I'm sure the people of Great Britain will make the right decision."
Speaking on behalf of the Scottish anti-independence Better Together campaign, Labour shadow foreign secretary Douglas Alexander said: "I welcome this important contribution by President Obama. His clear statement of support for the UK staying together will resonate with many of us here in Scotland.
"As a global statesman President Obama understands that interdependence is a defining feature of our modern world, and that building bridges, not putting up new barriers, is the challenge of our generation."