Libya's Gaddafi given ultimatum
He said the terms of a UN Security Council resolution backing action to defend civilians were "not negotiable".
Col Muammar Gaddafi's government has declared a unilateral ceasefire, as attack plans are drawn up against him under the UN resolution.
There are reports government offensives are continuing despite the ceasefire.
Libyan officials have dismissed these as untrue and say international observers are being invited to Libya to verify the situation.
In the rebel-held western city of Misrata, which is surrounded by government forces, residents there told Reuters news agency that there was no sign of a ceasefire and that the city continued to be pounded by bombs and artillery.
And Arabic TV station al-Jazeera reported that pro-Gaddafi forces were advancing quickly towards the eastern rebel stronghold of Benghazi on Friday evening. Its correspondent reported that loyalist forces were clashing with rebels in the towns of al-Magroun and Slouq, about 50km (30 miles) from the city.
The city of Zawiya has already fallen to pro-Gaddafi forces, while there has been fierce fighting in and around Ajdabiya in recent days.
Mr Obama said: "All attacks against civilians must stop. Gaddafi must stop his troops from advancing on Benghazi, pull them back from Ajdabiya, Misrata and Zawiya, and establish water, electricity and gas supplies to all areas.
"Humanitarian assistance must be allowed to reach the people of Libya.
"Let me be clear, these terms are not negotiable. If Gaddafi does not comply, the international community will impose consequences, and the resolution will be enforced through military action.
"Our goal is focused, our cause is just and our coalition is strong."
The US ambassador to the UN, Susan Rice, told CNN that Col Gaddafi was in violation of the UN Security Council resolution, adopted on Thursday, which called for an immediate ceasefire and banned all flights over Libya.
But Libya's Deputy Foreign Minister, Khaled Kaim, said on Friday evening that Libyan government forces had conducted no military operations since announcing the ceasefire earlier.
"We have had no bombardment of any kind since the ceasefire was declared," he told reporters when asked about reports of continued government operations in Misrata and other parts of the country; Kazinform cites BBC News.
See www.bbc.co.uk for full version