The spectacular about-face comes after more than 2,300 children were stripped from their parents and adult relatives after illegally crossing the border since May 5 and placed in tent camps and other facilities, with no way to contact their relatives.
Despite the order, there was no plan in place to reunite the thousands of children already separated from their families, according to multiple US media reports, citing officials from the Health and Human Services Department.
Those kids would remain separated while their parents were under federal custody during immigration proceedings, according to The New York Times.
Pictures and accounts of the separations sparked outrage and a rebellion among Republicans in Trump’s own party, as well as international accusation that the US was committing human rights violations.
"What we have done today is we are keeping families together," Trump said as he signed the executive order. "I didn’t like the sight or the feeling of families being separated."
Trump said that even with the change, border enforcement will be "equally tough, if not tougher."
He reiterated that sentiment at a campaign-style rally of supporters in the northern state of Minnesota later Wednesday, saying "we will keep families together, but the border is going to be just as tough."
He then accused rival Democrats of putting "illegal immigrants before they put American citizens."
For weeks, Trump had insisted he was bound by law to split the children from their parents and that only Congress could resolve the problem -- before he radically shifted gears.
"We want security for our country," Trump said. "And we will have that -- at the same time, we have compassion, we want to keep families together."
The order says the Department of Homeland Security -- and not the Justice and Health and Human Services Departments, as under previous policy -- would have continuing responsibility for the families.
It also suggests the government intends to hold the families indefinitely by challenging an existing statute, the 1997 Flores Settlement, that places a 20-day limit on how long children, alone or with their parents, can be detained.
That move could lead to new legal battles for the administration.
Trump said there was a need to sustain his zero tolerance" policy to prevent crime, which he blames illegal immigrants for.
"We still have to maintain toughness, or our country will be overrun by people, by crime, by all of the things that we don’t stand for and we don’t want," he said.
’Deeply disturbing’ images
Earlier, as countries marked World Refugee Day on Wednesday, world leaders assailed Trump for the separations.
British Prime Minister Theresa May, Canadian Prime Minister Justin Trudeau, the Council of Europe and Pope Francis all took issue with the "zero tolerance" policy.
May said images of migrant children kept in cage-like units were "deeply disturbing," and the Council of Europe, a global human rights watchdog, said Trump had abdicated any claim to moral leadership in the world.
After a downturn last year, since October, the number of migrants seeking to cross the southwest US border from impoverished Guatemala, El Salvador and Honduras, as well as from Mexico, has surged.
From March to May this year, more than 50,000 people a month were apprehended for illegally crossing the border from Mexico. About 15 per cent of those are arriving as families, and eight percent as unaccompanied children.
Nearly all of the families, and many others, have officially requested asylum, citing the incessant violence in their home countries.
The policy, with mandatory separation of children from adults, was announced May 7 as a deterrent.
The issue struck an emotional chord, amid accounts of children screaming and crying in facilities prepared for them.
Gene Hamilton, a senior Justice Department official, said the executive order was a "stopgap" move and that Congress needs to pass new legislation to give the president more powers to fight illegal immigration.
Current laws including the Flores Settlement, he argued, simply encouraged people to enter the country with their children, expecting to be caught and then released into US society.
"Congress needs to provide a permanent fix for this situation," he said.
Democrats and Republicans had at least two bills crafted on Wednesday to address broader immigration issues, but it was not clear if any had adequate support to pass.
But Democrats and rights groups were immediately critical of the plan to change the Flores Settlement.
"The Flores settlement prohibits the indefinite detention of children -- even with their families -- and any order to undermine this critical protection will be immediately challenged in court," said senior Democratic Senator Dick Durbin.
"Locking up whole families is no solution at all -- the Trump Administration must reverse its policy of prosecuting vulnerable people fleeing three of the most dangerous countries on earth, who are attempting to seek safe haven in America." —AFP/VNS