WASHINGTON—President Trump said he wants to keep undocumented immigrants apprehended at the border in detention until their legal cases are heard, rather than allow them to be released into the U.S. to await a hearing.

The remarks Thursday are the latest hard-line immigration pledge the president has made ahead of the midterm elections next week. It follows on the heels of his plan to send thousands of U.S. troops to support border-control efforts and his claim that he intends to use an executive order to end birthright citizenship for children born to illegal immigrants, something legal scholars called unconstitutional.

In his remarks, Mr. Trump said he intends to sign a “comprehensive” executive order next week about holding apprehended migrants, including those seeking asylum status. Mr. Trump gave few details, but said the plan would involve housing migrants in tents and other facilities.

“The endemic abuse of our asylum system makes a mockery of our immigration system and displacing legitimate asylum seekers, and there are legitimate asylum seekers,” Mr. Trump said in a White House speech. He said smugglers and human traffickers had learned how to “game” the U.S. system.

Mr. Trump also said that, under his plan, migrants seeking asylum would have to present themselves at an official point of entry. “Those who choose to break our laws and enter illegally will no longer be able to use meritless [asylum] claims to gain automatic admission into our country,” he said. Current U.S. law states that “any alien who is physically present” in the country can apply for asylum, within a year of arriving.