The blasts left part of the hospital in flames and rubble, killing 12 staffers and seven patients -- including three children -- and injuring 37 other people, the charity said.
As the United States said it was investigating what struck the hospital during the night, the charity expressed shock and demanded answers, stressing that all combatants had been told long ago where the hospital was.
"(The bombing) constitutes a grave violation of international humanitarian law," Doctors Without Borders, known internationally as Medecins Sans Frontieres, or MSF, said.
"There are many patients and staff who remain unaccounted for. The numbers may grow as a clearer picture develops of the aftermath of this horrific bombing," MSF said, adding all the dead and injured were Afghans.
The bombardments continued even after U.S. and Afghan military officials were notified the hospital was being attacked, the charity said.
The circumstances weren't immediately clear, but the U.S. military was conducting an airstrike in Kunduz at the time the hospital was hit, U.S. Army Col. Brian Tibus said.
The military is investigating whether a U.S. AC-130 gunship -- which was in the area firing on Taliban positions to defend U.S. special operations troops there -- is responsible, a U.S. military official said on condition of anonymity.
The White House released a statement from President Barack Obama offering condolences to the charity from the American people.
"The Department of Defense has launched a full investigation, and we will await the results of that inquiry before making a definitive judgment as to the circumstances of this tragedy," the President said. "I ... expect a full accounting of the facts and circumstances."
The top U.S. and NATO military commander in Afghanistan said he spoke to Afghan President Ashraf Ghani about the deadly airstrike, the U.S. military said.
"While we work to thoroughly examine the incident and determine what happened, my thoughts and prayers are with those affected. We continue to advise and assist our Afghan partners as they clear the city of Kunduz and surrounding areas of insurgents. As always, we will take all reasonable steps to protect civilians from harm," said Gen. John F. Campbell.
The incident occurred on roughly the sixth day of fighting between Afghan government forces -- supported by U.S. air power and military advisers -- and the Taliban, which invaded the city early this week.
According to MSF, the compound is gated and no staff members saw any fighters there or nearby.
"If there was a major military operation going on there, our staff would have noticed. And that wasn't the case when the strikes occurred," Christopher Stokes, the charity's general director, told CNN.
One nurse said in an article on the MSF website that he was sleeping in a safe room when he was awakened by a large explosion. The bombing lasted about an hour, Lajos Zoltan Jecs said.
As he went to help the wounded, he and others tried to save a doctor. He died on an office table, Jecs said. The nurse saw six patients who had burned to death in their beds. Another patient was dead on an operating table.
"I have no words to express this. It is unspeakable," he said.
Charity: We told everyone of our location
The charity, which had had been caring for hundreds already hurt in days of fighting, said it had told all warring parties the exact location of the trauma center, including most recently on Tuesday.
When the aerial attack occurred, 105 patients and their caretakers were in the hospital. More than 80 MSF international and national staff were present.
The U.S. special operations troops were in the area advising Afghan forces, the military official who was speaking anonymously said. The official stressed that the information about the probe was preliminary.
Pribus said a "manned, fixed-wing aircraft" conducted a strike "against individuals threatening the force" at 2:15 a.m. local time, and that the strike "may have resulted in collateral damage to a nearby medical facility."
The AC-130 is a large, fixed-wing gunship built on a C-130 Hercules cargo plane airframe, according to Boeing, the manufacturer.
The AC-130U, the most advanced model, is armed with a 25-mm Gatling gun, a 40-mm cannon and a 105-mm cannon, according to the Boeing website.
Mourning and condemnation
The U.N. mission in Afghanistan sharply condemned the airstrike.
"I condemn in the strongest terms the tragic and devastating air strike on the Médecins sans Frontières hospital in Kunduz early this morning, which resulted in the deaths and injury of medical personnel, patients and other civilians," said Nicholas Haysom, head of the United Nations Assistance Mission in Afghanistan.
The U.S. Embassy in Kabul expressed condolences on its Facebook page.
"The U.S. Embassy mourns for the individuals and families affected by the tragic incident at the Doctors Without Borders hospital, and for all those suffering from the violence in Kunduz," it read. The embassy praised the group's work as "heroic."
The International Committee of the Red Cross also expressed condemnation.
"Such attacks against health workers and facilities undermine the capacity of humanitarian organizations to assist the Afghan people at a time when they most urgently need it," said Jean-Nicolas Marti, Head of the ICRC delegation in Afghanistan.
Taliban's fight in Kunduz
Earlier in the week, the MSF hospital was caught in the crossfire between the Taliban and Afghan security forces
who were supported by U.S. troops. The battle encroached on the hospital's gate.
Bullets broke windows and punctured the roof of the intensive care unit.
The Taliban captured Kunduz earlier this week in the group's biggest victory in 15 years. It was a major setback for Afghan forces.
Afghanistan said it reclaimed most of the city Thursday in a big operation backed by U.S. airstrikes.
But hours later, there were signs that the Taliban were back in Kunduz, a resident told CNN. Gunshots erupted near the airport.
Kunduz is a strategic hub on the main highway between Kabul and Tajikistan.
On Thursday, Taliban fighters also took the Warduj district of Badakhshan, east of Kunduz province.
Retired U.S. Army Lt. Gen Mark Hertling said it was common for facilities such as hospitals to give combatants their coordinates.
"The coalition air forces will put something called a no-fly area on that GPS coordinate, so you have a pinpoint dot on a map, where you say something is there ... don't hit it," Hertling said.
"But when the fluidness of the battlefield takes place and you have engagements with troops on the ground, sometimes there are mistakes," he said.