Obama, weighing in with his first comments on the crisis, made clear he was firmly on the side of US ally Israel against the Palestinian militant group, but he also seemed to appeal to Israeli Prime Minister Benjamin Netanyahu to allow more time for Middle East leaders to rein in Hamas.
And he warned those in the region who support Palestinian aspirations for statehood that any peace deal would be pushed off "way into the future" if the Gaza conflict escalated.
"There's no country on earth that would tolerate missiles raining down on its citizens from outside its borders," Obama told a news conference during a visit to Thailand. "So we are fully supportive of Israel's right to defend itself."
Israel bombed Palestinian militant targets in the Gaza Strip from air and sea for a fifth straight day on Sunday, preparing for a possible ground offensive while also spelling out its conditions for a truce.
Palestinians launched dozens of rockets into Israel and targeted its commercial capital, Tel Aviv, for a fourth day.
"We're actively working with all parties in the region to see if we can end those missiles being fired without further escalation of violence in the region," Obama said during his first trip abroad since winning re-election on Nov. 6.
He noted that he had spoken regularly during the crisis with Netanyahu, with whom he has had a testy relationship.
But Obama was more pointed in talking about his conversations with Egypt's new Islamist president, Mohamed Mursi, and with Turkish Prime Minister Tayyip Erdogan, who have been strongly critical of Israel's air assault on Gaza.
"What I said to President Mursi and Prime Minister Erdogan is those who champion the cause of the Palestinians should recognize that if we see a further escalation of the situation in Gaza then the likelihood of us getting back on any kind of peace track that leads to a two-state solution is going to be pushed off way into the future," he said.
With Netanyahu warning that Israel was ready to widen its offensive, Obama said his message to all leaders in the region was that Israel "has every right to expect that it does not have missiles fired into its territory".'Ramping up'
"If this can be accomplished without a ramping up of military activity in Gaza, that is preferable," he said when asked if he would support an Israeli ground assault. "That's not just preferable for the people of Gaza, it's also preferable for Israelis because if Israeli troops are in Gaza they're much more at risk of incurring fatalities or being wounded."
"We're going to have to see what kind of progress we can make in the next 24, 36, 48 hours," Obama added.
He said Hamas's rocket barrages were the "precipitating event" in the conflict and had to be stopped. The United States, like Israel, considers Hamas a terrorist organization.
Obama promised to make Israeli-Palestinian peace diplomacy a high priority when he took office in 2009, but his administration's on-again-off-again efforts have done little if anything to bring the two sides any closer to the negotiating table.
In Washington, senior US lawmakers said they would be understanding of a potential Israeli ground invasion of Gaza.
"If sending ground troops in is the only way they can clean out these nests of rockets being fired at them, you know, you can't blame them for doing it," Republican US Senator Saxby Chambliss, chairman of the Senate Intelligence Committee, told the "Fox News Sunday" program.
Asked whether Obama should put more pressure on the Egyptian government - including a threat to cut off aid - to get Hamas to stop firing rockets, Chambliss said: "He needs to exert every kind of pressure he can ... to try to make sure this doesn't escalate into a full-blown war between the Palestinians and the Israelis. And, you know, whatever that takes."
Senator Lindsey Graham, a key Republican voice on foreign policy, added a warning to Egypt.
Speaking on NBC's "Meet the Press" program, Graham said: "Egypt, watch what you do and how you do it. You are teetering with the (US) Congress in having your aid cut off if you keep inciting violence between the Israelis and the Palestinians."
Senator John McCain, the top Republican on the Senate Armed Services Committee, said the United States needed to be heavily involved in the latest conflict.
"The United States obviously should be as heavily involved as it possibly can," McCain said on CBS's "Face the Nation" television show. "I'm not sure how much influence that this administration has," he said, following failed efforts in 2009 to help bridge differences between Israelis and Palestinians.
"The United States of America has got to push as hard as we can to resolve this Israeli-Palestinian issue. So many events are hinged on making that process go forward."
BANGKOK (Reuters) -- President Barack Obama said on Sunday it would be "preferable" to avoid an Israeli ground invasion of Gaza but put the onus on Egypt and Turkey to get Hamas to halt cross-border rocket fire, saying Israel had a right to defend itself from attack.