The president said that if migrants “throw rocks at our military” then US soldiers should “consider it a rifle”.
Donald Trump says he is finalising a plan to force migrants to present themselves at a legal port of entry to get into the US.
The president, speaking in the Roosevelt Room of the White House, told reporters: “We have no choice.
“We will defend our borders and we will defend our country.”
He added: “No nation can allow itself to be overwhelmed by uncontrolled people rushing our border.”
Mr Trump, whose core supporters back a tough line on immigration, later told reporters: “They’re throwing rocks viciously and violently.
“You saw that three days ago. Really hurting the (Mexico) military.
“We’re not going to put up with that.
“They want to throw rocks at our military, our military fights back.”
He added: “When they throw rocks like they did at the Mexico military and police, I say consider it a rifle.”
Mr Trump had earlier repeated his claim that a caravan of thousands of Central American migrants heading to the US-Mexico border is “like an invasion”.
The president added that the “illegal aliens” should “turn back now”
He claimed the caravan of migrants is causing “a crisis on our southern border” and said: “This is a perilous situation (that will) become even more hazardous.”
Mr Trump has unveiled his immigration policy ahead of the midterm elections on 6 November.
His successful 2016 presidential campaign had a strong focus on border security.
Sky’s US correspondent Amanda Walker said: “The president spoke with a menacing tone, and presented a very dark notion of what is happening.
“The reality is that there are about 5,000-6,000 migrants heading to the US-Mexico border.
“He wants to say to his voters that ‘this is an invasion’ and ‘I’m going to protect you against it’.”
Mr Trump told reporters on Thursday that immigrants “cost our country billions and billions of dollars each year”, adding that they put an “enormous strain on our local schools, hospitals and communities in general”.
The president said earlier on Thursday that the number of troops deployed to the US-Mexico border could reach 15,000.
The figure took the Pentagon by surprise as it had only planned to send 7,000 troops to support border agents.
Mr Trump has also hinted that state department spokeswoman Heather Nauert is “under very serious consideration” to be the next US ambassador to the UN.
Meanwhile, TV star Oprah Winfrey has been out campaigning in Atlanta, Georgia, where she has been knocking on doors asking for support for a Democrat candidate governor.
Should she win, Stacey Abrams would become the first black female governor of the state. Sky News.