In his remarks, Trump told U.S. troops that he's overseeing a massive military buildup, and praised soldiers for pushing themselves to "new heights of excellence."
Trump said the nation's military had been "asked to do more with less" for too long.
The president also said he remains optimistic about a new U.S. effort to engage with North Korea. Trump said the U.S. is "prepared for anything," but that he believes "something positive will happen." Trump has agreed to meet with North Korean leader Kim Jong Un this spring.
Trump also pointed to American efforts to lead in space. He predicted that "very soon we're going to Mars" and added that "you wouldn't be going to Mars" if his opponent, Hillary Clinton, had won the 2016 election.
Update, 1:20 p.m. Tuesday:
At the border, President Trump spoke with Border Patrol agents about fence modifications over the years. In the 1990s, Trump said, the border was porous but has improved in more recent years. However, he said the structure is still inferior and deters only about 95 percent of criminal activity.
"If you didn't have even these remnant walls, we call them remnant walls because they're very old, you'd have crime in numbers that would far surpass what you see today," he said. "We’ve cut down and way down on crossings, border crossings because of the job that the Border Patrol does."
Trump said that with a new wall, "We’re going to stop 99 percent, maybe more than that."
He called on Congress to fund the border wall and "prohibit grants to sanctuary jurisdictions."
"Sanctuary cities are protecting a horrible group of people, criminals," he said.
Update, 1 p.m. Tuesday:
President Trump has arrived to view wall prototypes at the U.S.-Mexico border.
While viewing the wall prototypes, Trump pointed to what he said were issues with the current barrier.
"If you take a look at the fence — and it’s a very powerful fence — it's not doing the trick because they cut holes in it and then they’re patching holes in it all the time," the president said.
In response to a reporter's question about California Gov. Jerry Brown, Trump said, "Gov. Brown has done a very poor job running California."
Trump said Brown "is a nice guy," but that California taxes are very high. Trump also criticized the existence of sanctuary cities.
In advance of Trump's visit, Brown said Trump should focus on "bridges, not walls."
Earlier, supporters and opponents of Trump gathered at rallies near the U.S.-Mexico border crossing in advance of the president's visit.
A crowd of about 100 protesters stood near the San Ysidro border crossing about 11 a.m. The crowd will march to Our Lady of Mount Carmel Church in San Ysidro.
Another crowd of about 100 supporters of the president gathered at Brown Field near the border.
When Donald Trump visits San Diego to examine prototypes of the border wall Tuesday, the president will be landing in the largest city on the U.S.-Mexico border to formally oppose his plans.
Numerous rallies are planned by groups both for-and-against Trump and his push to build a "big, beautiful wall" separating the two countries. Trump will make his first visit to the city since being elected. Protests are also being planned across the border in Tijuana, Mexico.
Organizers on both sides were urging people to remain peaceful after recent scuffles at rallies in Southern California, including brawls at a Dec. 9 rally near where the prototypes stand.
In San Diego on Monday, immigrant activists, church leaders and elected officials held a press conference at the city's historic Chicano Park to call for demonstrations to show border communities do not support a wall. Standing in front of murals of Mexican revolutionaries, they chanted "We reject your hate! We don't need your racist wall!"
"It's really important that as a region, as a city that has firsthand understanding of what the border wall means for our communities that we stand against (this) and we send a strong message to DC to say this is something that we don't welcome," City Councilwoman Georgette Gomez said Monday.
Gomez sponsored a resolution passed by the San Diego City Council in 2017 opposing the wall, calling it detrimental to the city's environment and tourism. It also expressed the city's intent to divest from the companies involved in the construction, financing and design of the wall.
Republican Mayor Kevin Faulconer did not support the resolution but also did not veto it. The mayor's office said Faulconer has been clear in his opposition to walls along the border but he did not want to blacklist companies involved in the construction of the prototypes.
"When some people look at the U.S.-Mexico border, they see division," Faulconer said in his State of the City address in 2017. "But here in San Diego we view it much differently. Rather than allowing the border to divide us, we're building bridges that connect us."
Jeff Schwilk, founder of San Diegans for Secure Borders, whose group participated in the rally in December near the prototypes that ended in clashes with counterprotesters, said the City Council's resolution does not reflect the views of many residents, who feel the border is not secure. He said his organization respects free speech and hopes Tuesday's rally will be safe for participants.
"We absolutely want President Trump to feel welcome and to come inspect the prototypes so we can get the wall built," he said.
Trump on Tuesday is expected to be briefed on lessons learned from the prototypes' construction and meet with border agents and officers to ask what they need, said Jonathan Hoffman, Homeland Security spokesman.
The president is determined to fulfill his campaign promise and will not be swayed by California Republican lawmakers concerned the wall is a waste of money, White House spokeswoman Sarah Huckabee Sanders told reporters Monday.
"The president campaigned on this, he talked about it extensively and he's the president and this is something that he is not going to back away from," she said. "It's something that he's going to continue to push for."
California Gov. Jerry Brown on Monday invited Trump to also visit the state's high-speed rail construction projects.
"You see, in California we are focusing on bridges, not walls," Brown, a Democrat, said in a letter sent to Trump.
Trump's visit comes just days after his Justice Department sued to block California laws designed to protect people living in the U.S. illegally and U.S. Attorney General Jeff Sessions followed up with a speech in Sacramento that was immediately denounced by Brown, who said the Trump administration was "full of liars."
California Attorney General Xavier Becerra, who has sued the Trump administration more than two dozen times within the past year, said he hopes the president will take away lessons about the state's economic prowess, its strict gun laws and its environmental focus.
And he vowed to keep fighting against efforts to "send us backward."