Francis also called for a fairer world economy, the abolition of the death penalty, the protection of ethnic and religious minorities, the outlawing of the global "blood" trade in arms and the protection of the family in a speech sure to please liberals.
The speech underscored the emergence of Pope Francis as a global political leader -- rather than a moral or spiritual voice alone. His boldness in staking out positions on the nation's most pressing issues could reverberate through Capitol Hill and the 2016 presidential race in the months to come.
Practicing what he preached, the wildly popular pontiff, who has drawn thousands onto the streets along with blanket media coverage during his U.S. visit, then headed to pray and eat with homeless people and to pose for selfies with his adoring flock.
The Pope, who was greeted by cheers as he stepped onto the floor of the House of Representatives and received several standing ovations and sustained applause during his address, did not scold lawmakers -- his tone was more akin to that of a sermon or a pep talk. But he did not shirk from delivering blunt political messages.
He laid out an implicit counter-argument to some conservatives, including 2016 Republican front-runner Donald Trump, who believes that the more than 10 million undocumented immigrants in the country should be deported. He implied that to do so would repudiate America's founding purpose as a nation born of immigrants seeking a better life.
"We, the people of this continent, are not fearful of foreigners, because most of us were once foreigners," he said, as Vice President Joe Biden and an often tearful Republican House Speaker John Boehner, both Catholics, watched from the dais.
"I say this to you as the son of immigrants, knowing that so many of you are also descended from immigrants," Francis told the audience of lawmakers, top military brass, Supreme Court justices and Cabinet members on the floor of the House.
He made a clear connection between undocumented immigrants in the U.S. and the exodus of Syrians and others into Europe from wars raging in the Middle East.
"On this continent, too, thousands of persons are led to travel north in search of a better life for themselves and for their loved ones, in search of greater opportunities," he said of migrants from Central and South America, indicating they needed to be treated as people seeking refuge rather than as exploiting the United States' porous borders.
In an apparent rebuke to politicians who have criticized the tide of undocumented immigrants, he continued, "We must not be taken aback by their numbers, but rather view them as persons, seeing their faces and listening to their stories, trying to respond as best we can to their situation."
Then, citing Scripture to drive home his argument, Francis said: "Let us remember the Golden Rule: 'Do unto others as you would have them do to you.'"
He called on often warring lawmakers to honor the example of their greatest national heroes, like Martin Luther King, Jr. and Abraham Lincoln.
Francis appeared to reflect on news coverage of racial violence over the past year and a debate over the place of Muslims in U.S. society that arose in recent weeks.
Citing Martin Luther King's "dream of full rights for all their brothers and sisters," he urged Americans in the 50 minute speech to remember the civil rights icon's legacy of "liberty in plurality and non-exclusion."
Referring to turmoil tearing apart the Middle East, Francis warned the world was increasingly a place of fundamentalism and "brutal atrocities" sometimes committed in the name of religion, but he warned against a simplistic world view pitting good versus evil or "the righteous and the sinners."
"We know that in the attempt to be freed of the enemy without, we can be tempted to feed the enemy within," Francis warned.
Clearly conscious that many conservatives in Congress are skeptical that mankind is contributing to global warming, he called for a courageous and responsible effort to avert "environmental deterioration caused by human activity" and said Congress had an "important role to play."
He also praised efforts in recent months to "help overcome historic differences linked to painful episodes of the past," a passage that President Barack Obama's supporters may take as approval of his controversial policies towards Cuba and Iran.
Amid criticism that he is overly critical of global capitalism and dismisses its place in lifting millions of people out of poverty, Francis acknowledged that "business is a noble vocation, directed to producing wealth and improving the world."
But he cautioned that wealth should be shared and geared to "the creation of jobs as an essential part of its service to the common good."
He did, however, cut one section of his prepared speech, in which he referred to the Declaration of Independence and said that politics should not be a "slave to the economy and finance."
Vatican spokesman Father Lombardi later said the Pope made a "little oversight" and skipped those lines by mistake, with the prepared text of the speech to Congress remaining the official version.
The Pope also counseled members of the unpopular and divided Congress of the need to move forward together in a generous spirit of fraternity.
"The challenges facing us today call for a renewal of that spirit of cooperation, which has accomplished so much good throughout the history of the United States," he said, and called on America to act on his appeals.
"The complexity, the gravity and the urgency of these challenges demand that we pool our resources and talents and resolve to support one another, with respect for our differences and our convictions of conscience," he said.
Francis, who will take part Sunday in a World Meeting of Families in Philadelphia on the last stop of his trip to the United States, also made an oblique reference Thursday to the increasing prevalence of same-sex marriage, which the Supreme Court endorsed nationwide earlier this year.
"I cannot hide my concern for the family, which is threatened, perhaps as never before, from within and without," Francis said. "Fundamental relationships are being called into question, as is the very basis of marriage and the family."
The Pope drew cheers, especially from the Republican side of the House, when he spoke of the need to "protect and defend human life at every stage of its development," in a reference to abortion.
But he earned only a smattering of applause when he said that reverence for life also means supporting the global abolition of the death penalty. Francis threw his weight behind efforts to pass criminal justice reform, saying society "can only benefit from the rehabilitation of those convicted of crimes."
There were also signs of a partisan split in the chamber when Francis mentioned global warming and immigration, which Democrats applauded while many Republicans did not.
But despite the progressive content of his speech, Francis appeared to avoid offending anyone.
"We found ourselves standing up and sitting down more than what we anticipated," Republican Sen. Mike Rounds told CNN's Dana Bash. Former GOP vice presidential nominee Rep. Paul Ryan told CNN that it would be wrong to treat the speech as "a sort of laundry list of policies."
Democratic presidential candidate Sen. Bernie Sanders, meanwhile, welcomed the liberal content of an address that he described as dignified and nonpartisan.
After his speech, Francis appeared on the Speaker's balcony along with bipartisan leaders of Congress and smiled broadly at the thousands of people gathered below on the National Mall. He singled out children for special mention, and asked even those who had no faith and could not pray to send him good wishes.
After making brief remarks in Spanish on the balcony, Francis concluded by declaring in English, "God bless America!"
He then went to St Matthew's Cathedral to pray with homeless people. He was mobbed by admirers outside, smiling broadly at children and posing for pictures shot on mobile phones, as Secret Service agents and Vatican officials cleared his way through the crowd.
"In prayer, there are no rich or poor people," the pontiff said in the church. "There are sons and daughters."
"Today I want to be one with you," he said. "I need your support, your closeness."
Francis later flew out of Joint Base Andrews outside Washington and headed to New York, where he will ride his popemobile through Manhattan and lead evening prayers at St Patrick's Cathedral before speaking at the United Nations on Friday. He will conclude his six-day visit to the United States in Philadelphia on Sunday.