WASHINGTON—President Trump in a prime-time address Tuesday said a wall along the southern border is key to national security, as he called for lawmakers to fund it and end a partial government shutdown that is days away from becoming the longest in U.S. history.

In the televised address from the Oval Office, Mr. Trump’s first in his nearly two years as president, he emphasized what he said was support for wall funding from law-enforcement officials, who he said requested the more than $5 billion for the barrier that Mr. Trump...