"This is national security we're talking about. We're not playing games," Trump said following another round of talks at the White House with Democratic leaders on ending the two-week impasse which has shut about 25 percent of the government, AFP reported.
"The southern border is a dangerous, horrible disaster," he said, decrying illegal immigration, drug smuggling and human trafficking.
"We have to get a structure built," Trump said, calling on Congress to approve his $5.6 billion request for a "major powerful barrier" made of concrete or steel.
Trump also claimed that some previous US presidents had told him they should have built a wall. None of Trump's predecessors has ever publicly advocated such a thing.
Describing the situation as a "national emergency," Trump said he was looking into ways to get a wall built without congressional approval. "I may do it," he said. "I am allowed to do that."
Chuck Schumer, the Senate minority leader, said Democrats had urged Trump during what he called a "sometimes contentious" meeting to reopen the federal government, which has been partially shut down since December 22 leaving 800,000 employees furloughed or working without pay.
A handful of those employees held a roadside protest in Maryland on Friday, saying they want to get back to work.
"We told the president we needed the government open," Schumer said. "He resisted. In fact, he said he'd keep the government closed for a very long period of time. Months or even years."
Asked by reporters whether this was true, Trump said it was although he added that he hoped the shutdown "doesn't go on even beyond a few more days."
"I will do whatever we have to do," Trump said. "If we have to stay out for a very long period of time we will do that."
Talks over weekend
Trump said a bipartisan group including Vice President Mike Pence would meet over the weekend to try to reach an agreement.
"Our aim will be to find a solution, not just simply to end the government shutdown, to provide funding to end the crisis at our southern border, to achieve real border security and to build a wall on our southern border," Pence said.
A quick end to the stalemate does not appear to be in sight, however, as Democrats, who now control the House of Representatives, seem in no mood to make concessions.
"We are committed to keeping our borders safe," Nancy Pelosi, who took over as speaker of the House on Thursday, told reporters following the meeting with the president.
But, Pelosi added, "we recognize on the Democratic side that we really cannot resolve this until we open up government.
"And we made that very clear to the president," she said. "Services are being withheld from the American people. Paychecks are being withheld."
Both Democrats and Republicans have attempted to pin the blame for the shutdown on the other side and Pelosi has ruled out funding for a border wall she has described as an "immorality."
Shortly after the new Congress was sworn in on Thursday, the House approved legislation to fund homeland security operations until February 8 and several other agencies through September – but no money for a wall.
Trump has said he would veto any bill that does not include funding for the barrier and the Republican-run Senate has said it would not consider anything that does not pass muster with the president.