At a joint press conference during the G-7 summit in Brussels with British Prime Minister David Cameron, Obama said the UK had been "an extraordinary partner" and that, as a foreigner, it seems to have worked well as unit.
Obama told reporters: "There is a referendum process in place and it is up to the people of Scotland.
"The United Kingdom 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 that one of the closest allies we will ever have remains a strong, robust, united and effective partner.
"But ultimately these are decisions that are to be made by the folks there."
Scotland is set for a referendum on September 18 to decide whether its future belongs within a union with Britain or as an independent state.
Until now the Obama administration has been carefully neutral about the referendum but Douglas Alexander, the shadow foreign secretary, said this was a significant intervention.
"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," he said.
US diplomats have previously said the country would remain neutral in both the independence and EU debates.
Obama also said he thought it "hard to be advantageous" for the UK to leave the EU.
The Scottish government has yet to comment on Obama's remarks on the independence referendum. It has previously said that an independent Scotland would retain close ties with the rest of the UK and the United States.