A video posted to social media shows the officer on her knees being repeatedly struck on the head by a girl, then attacked from behind by another as the first girl tries to get away.
Police said the officer, whose name has not been released, used pepper spray in an attempt to gain control of the situation.
"In the moment, she did what she had to do, there was nobody injured as a result of this, and the two parties are under arrest," Paul Black, president of the Peel Regional Police Association, said in a news conference.
Asked why the officer didn't draw a gun or use a Taser, he said "she deployed what she had on her at the time."
The officer, a six-year member of the force, is "doing fine" despite suffering minor injuries and was back on duty, Black said.
Describing her as "humble," Black said the officer had returned to work on Wednesday and wished to stay out of the spotlight.
Peel police Const. Fiona Thivierge confirmed the video, saying the incident happened around 12:30 p.m. Tuesday following a report that two female suspects were allegedly trespassing at a Brampton, Ont., high school.
When they refused to leave, they were placed under arrest, "at which time they engaged (the officer) in a physical confrontation that resulted in her using her pepper spray in an attempt to get control of the situation," Thivierge said.
The girls were able to escape the officer and were subsequently arrested by another officer who had come on the scene.
The officer "showed amazing restraint under the circumstances," Thivierge said.
"She was able to get on her radio and call for backup. So other officers were there and she was able to stand back and just let them take over so she could catch her breath."
Thivierge said it was "quite shocking" to see her colleague being assaulted and to hear the person shooting the video laughing.
The video drew hundreds of thousands of views online and prompted some commenters to praise the officer for her restraint while others questioned her training and response to the attack.
"The female police officer should be fired for being weak... She's a danger for herself and the rest of society," one wrote.
"She kept her calm, she did not beat them as many cops would have, and in the end, she apprehended them," wrote another.
Several people suggested a cop south of the border would have handled the incident differently.
"I don't think those two girls realize that if this were America, they would both be dead....." wrote another.
A 15-year-old girl is charged with trespassing, obstructing police, assaulting police and assisting in an escape from lawful custody.
A 16-year-old girl is charged with trespassing, assaulting police and escaping lawful custody.
The teens cannot be identified under provisions of the Youth Criminal Justice Act.
Thivierge says the girls, both from Brampton, are scheduled to appear in court on March 17.
— With files from Linda Shearman.
Link to video: