After viewing the mudslide from the air, Obama met for over an hour with relatives of victims in a small chapel.
The Snohomish County Medical Examiner's Office said the remains of 41 victims had been recovered from the slide that buried a river valley neighborhood in the Cascade mountain foothills last month.
A rain-soaked hillside collapsed above the north fork of the Stillaguamish River on March 22, unleashing a torrent of mud that swallowed up a stretch of a state highway and some three dozen homes on the outskirts of this small town.
The president's helicopter hovered not far above the site of the mudslide for about 15 minutes on Tuesday. Photographs showed a view of the broad gash where the hillside gave way, and a tangled heap of dirt and debris at its foot.
Obama, clad in khaki pants, boots and a navy blue windbreaker, also visited a community center and the Oso fire station, where he spoke with emergency workers and others involved in the rescue and recovery effort.
"These are folks who love this land and it's easy to see why - because it's gorgeous," he told an audience that included federal, state and local search-and-rescue crews.
"The country is thinking about all of you and has been all throughout this tragedy," he said. "We're not going anywhere. We'll be here for as long as it takes."
Behind the president, a banner read: "Oso Strong," and over his shoulder, a large aerial photograph showed the extent of the mudslide in the narrow valley. Homemade posters offering thanks and good wishes to the residents of Oso ringed the walls of the small fire station.
Obama has signed an emergency declaration ordering U.S. government assistance to supplement state and local relief efforts in the aftermath of the mudslide and flooding.
He came to Oso on his way to Asia, where he is due to visit Japan, South Korea, Malaysia and Philippines over the next eight days.