On the day after the U.S. harvest holiday of Thanksgiving, marked by an abundance of food, Obama stopped in at a heated tent on the National Mall, home to Washington's most famous monuments, where some activists have drunk only water since Nov. 12 in support of immigration legislation.
Republican House of Representatives Speaker John Boehner has refused to schedule a vote on a comprehensive immigration measure the Senate passed this summer that would offer a path to citizenship for the 11 million immigrants living in the U.S. illegally and tighten border security.
Many Republicans question offering citizenship to people who broke U.S. immigration laws.
"I want everybody to know I remain optimistic that we're going to get this done,'' Obama said, according to video of his remarks.
The White House issued a statement after the approximately 40-minute visit that said Obama thanked the hunger strikers "for their sacrifice and dedication and told them that the country is behind them on immigration reform.''
Organizers of the fast said Obama expressed concern for the health of the hunger strikers, and he held the shoe of an immigrant who died in the Arizona desert while trying to enter the U.S.
Immigration frustrations have been in the news in recent days. One man who was part of a backdrop for an Obama speech in California shouted during the president's speech for Obama to stop separating families by deporting people who are living in the country illegally.
Obama was the latest administration official to visit with the hunger strikers. Vice President Joe Biden, Cabinet secretaries and top White House advisers have also visited.
Obama won about 70 percent of the Hispanic vote in his re-election last year, leading some Republicans in the Senate to take a different approach than their House colleagues, expressing concern that the party's opposition to immigration reform could hurt future election prospects by alienating the rapidly growing Latino voting bloc.