The Taliban claimed responsibility for the attack, calling Malala's work "obscenity."
"This was a new chapter of obscenity, and we have to finish this chapter," said Taliban spokesman Ahsanullah Ahsan . "We have carried out this attack."
Malala and her family had been threatened by the Taliban before for her activism.
The school bus was about to leave the school grounds in Mingora when a bearded man approached it and asked which one of the girls was Malala, said Rasool Shah, the police chief in the town. Another girl pointed to Malala, but the activist denied it was her and the gunmen then shot both of the girls, the police chief said.
Malala was shot twice — once in the head and once in the neck — but her wounds were not life-threatening, said Tariq Mohammad, a doctor at the main hospital in Mingora. The second girl shot was in stable condition, the doctor said.
The attack displayed the viciousness of Islamic militants in Swat Valley, where the military conducted a major operation in 2009 to clear out insurgents. It was a reminder of the challenges of keeping the area free of militant influence.