By Agence France-Presse
Rahaf Mohammed al-Qunun was already en route to Toronto late Friday when the prime minister made the surprise announcement, after officials had previously given heavy hints she was bound for Australia.
"Canada has been unequivocal that we'll stand up for human rights and women's rights around the world," Trudeau said. "When the United Nations made a request of us that we grant al-Qunun's asylum, we accepted."
The move is sure to further strain Canadian relations with the kingdom that went sideways last August over Ottawa's rights criticism of Saudi Arabia, prompting Riyadh to expel the Canadian ambassador and sever all trade and investment ties in protest.
Canada also sparked fury in Riyadh by demanding the "immediate release" of jailed rights campaigners, including Samar Badawi, the sister of jailed blogger Raif Badawi, whose family lives in Quebec.
Qunun's attempt to flee the ultra-conservative kingdom was embraced by rights groups as a beacon of defiance against repression.
Thai authorities initially threatened to deport her after she arrived in Bangkok from Kuwait last weekend.
But armed with a smartphone and hastily opened Twitter account, she forced a U-turn from Thai immigration police who handed her into the care of the UN's refugee agency as the #SaveRahaf hashtag bounced across the world.
"Ms. al-Qunun's plight has captured the world's attention over the past few days, providing a glimpse into the precarious situation of millions of refugees worldwide," UN High Commissioner for Refugees Filippo Grandi said.
"Refugee protection today is often under threat and cannot always be assured, but in this instance international refugee law and overriding values of humanity have prevailed."
Raif Badawi's wife Ensaf Haidar also praised Canada, calling Foreign Minister Chrystia Freeland on Twitter "the real hero" behind efforts to prevent Qunun's repatriation to Saudi Arabia.
Qunun alleged that she was abused by her family -- who deny the allegations -- and rights groups also said she had renounced Islam, risking prosecution in Saudi Arabia.
Qunun first said she was aiming for Australia where officials had suggested they would give serious consideration to her claim for asylum, which was endorsed as legitimate by the UNHCR on Wednesday.
But late Friday Thailand's immigration police chief said a smiling and cheerful Rahaf was bound for Toronto and had left on a flight after 11:00 pm (1600 GMT).
"She chose Canada... Canada said it will accept her," Thai immigration chief Surachate Hakparn told reporters at Bangkok's main airport.
"She is safe now and has good physical and mental health. She is happy."
Qunun left from the same airport where her quest for asylum began less than a week ago in a swift-moving process that defied most norms.
On Friday afternoon Qunun posted a cryptic tweet on her profile saying "I have some good news and some bad news" -- shortly afterward, her account was deactivated in response to death threats she had faced, her friends said.
But she was back online later in the day, tweeting: "I would like to thank you people for supporting me and saiving my life. Truly I have never dreamed of this love and support."
Qunun's swift use of Twitter saw her amass more than tens of thousands of followers within a week, highlighting her plight at a time when Saudi Arabia's human rights record is under heavy scrutiny following the murder of journalist Jamal Khashoggi last year.
Her deployment of social media allowed her to avoid the fate of countless other refugees who are quietly sent back home or languish in Bangkok detention centers.
She refused to see her father ,who traveled to Thailand and expressed opposition to her resettlement.
Surachate said her father and brother were due to return home on a flight in the early hours of Saturday.
Although her asylum case moved fast the final maneuvers that led to her flight to Canada remain largely a mystery.
Australia had dropped strong hints it would accept her after the UN urged the country to do so and it remains unclear why the resettlement location changed.
On Thursday its foreign minister said Canberra was still assessing the request.
Thailand's immigration chief Surachate had earlier told reporters Friday that "two or three" countries were ready to offer her asylum.
The Southeast Asian country is not a signatory to a convention on refugees and asylum seekers must be referred to a third country.