Brenton Tarrant, a 28-year-old Australian, appeared in court on Saturday charged with murder. Two other people are also in custody.
Speaking a day after the shootings in Christchurch, Ms Ardern said: “Our gun laws will change.”
She added that none of those detained had a criminal record.
Mr Tarrant, who appeared in the dock in a white prison shirt and handcuffs, was remanded in custody without plea and is due appear in court again on 5 April.
The first victim of Friday’s attack has been named by his family as Daoud Nabi, 71, who moved to New Zealand from Afghanistan in the 1980s.
The identities of the other victims have not yet been released. A total of 48 people were wounded in the shootings.
Bangladesh, India and Indonesia all say some of their citizens were killed in the shooting and others are unaccounted for.
On Saturday, Christchurch Mayor Lianne Dalziel expressed “revulsion” at this “act of terrorism” and solidarity with the victims.
“We have welcomed new people into our city. They are our friends, they are our neighbours,” she told reporters. “We want to come together to support them.”
She added that flags would fly at half-mast on government buildings in the city “until further notice”.
Security remains tight across Christchurch. All mosques in New Zealand have been closed.
How events unfolded
The first report of an attack came from the Al Noor mosque in central Christchurch during Friday prayers at 13:40 (00:40 GMT).
A gunman drove to the front door, entered and fired on worshippers for about five minutes.
The gunman, who live-streamed the attack from a head-mounted camera, identified himself as Brenton Tarrant in the footage, which showed him shooting at men, women and children.
A survivor told the New Zealand Herald newspaper how he escaped through a window.
Moroccan-born Nour Tavis said he was in the front row when the shooting started.
“People were running and all of a sudden you saw them fall,” he said. He saw someone smash a window. “I followed… it was the safest place to get out.”
The wife of one of his friends was killed, he said.
“When she heard the noise, she wanted to go and make sure her husband was safe,” he said. “She got the bullet, her husband got away.”
The gunman is then said to have driven about 5km (three miles) to another mosque in the suburb of Linwood where the second shooting occurred.
One witness described how one of the worshippers had managed to disarm the man, who ran to a waiting car outside.
It is not clear where the arrests were made.
Police say they recovered firearms from both mosques, and explosive devices were found in a car belonging to one of the suspects.
According to the latest census figures, Muslims make up about 1.1% of New Zealand’s population of 4.25 million.
Numbers rose sharply as New Zealand took in refugees from various war-torn countries since the 1990s.
The main suspect
The main suspect had “travelled around the world with sporadic periods of time spent in New Zealand”, Prime Minister Ardern told reporters.
“I would not describe him as a long-term resident,” she said, without formally identifying him.
“The offender was in possession of a gun licence. I’m advised that this was acquired in November of 2017,” Ms Ardern said.
She said New Zealand intelligence services had been stepping up investigations into far-right extremists, but added: “The individual charged with murder had not come to the attention of the intelligence community nor the police for extremism.”
In the wake of Saturday’s attacks, social media accounts in the name of Brenton Tarrant were used to post a lengthy, racist document in which the author identified the mosques that were later attacked.
The man says he began planning an attack after visiting Europe in 2017 and being angered by events there.
The document is called “The Great Replacement” – a phrase that originated in France and has become a rallying cry for European anti-immigration extremists.
“It is clear that this can now only be described as a terrorist attack,” Ms Ardern told reporters.
US President Donald Trump offered his “warmest sympathy and best wishes” to New Zealand. “The US stands by New Zealand for anything we can do. God bless all!” he wrote.
UK Prime Minister Theresa May offered her “deepest condolences to the people of New Zealand”.
The Queen said she was “deeply saddened by the appalling events in Christchurch today. Prince Philip and I send our condolences”.
German Chancellor Angela Merkel said she mourned “with New Zealanders for their fellow citizens who were attacked and murdered out of racist hatred while peacefully praying in their mosques”.
And French President Emmanuel Macron called it an “odious attack” and said France stood “against any form of extremism”.
What are New Zealand’s gun laws?
The minimum legal age to own a gun in New Zealand is 16, or 18 for military-style semi-automatic weapons.
All gun-owners must have a licence, but most individual weapons do not have to be registered – New Zealand is one of the few countries where this is the case.
Applicants for a firearm licence must pass a background check of criminal and medical records, including factors such as mental health and domestic violence.
Once a licence has been issued, gun-owners can buy as many weapons as they want.