The hostages were freed before dawn on Sunday, when the soldiers stormed the militants' hideout outside the town of Isabela, the capital of Basilan island, about 900km (560 miles) south of Manila, army spokesman Major Alberto Gepilano said.
"Undetermined number of enemies were killed in the operation. Troops stormed an area where the terrorist where holed out in the jungle and at least 13 hostages were safely rescued including children," the major told the AFP news agency.
The Abu Sayyaf say they are fighting for independence for the Muslim minority in the south of the mainly Christian Philippines.
Raid on Lamitan
The 13 rescued hostages were among about 35 villagers captured by Abu Sayyaf in a raid on the town of Lamitan on Basilan on Thursday.
The army spokesman said the guerrillas beheaded 10 hostages, while 12 others were either released or had escaped.
The Abu Sayyaf group in Basilan is still holding around 20 people captured during raids in May, including two Americans taken from a luxury beach resort.
One hostage freed earlier passed on a demand from the Abu Sayyaf that the government stop its operation against the militants, a military source said on Saturday.
But Lieutenant General Jose Camiling rejected the demand.
"This cannot divert us from our main objective in crushing the group," he said.
Kidnapping campaign
Last week the Abu Sayyaf threatened to retaliate against Christians after the government detained about 100 suspected sympathisers of the movement.
But the BBC's John McLean in Manila says their principal occupation appears to be kidnapping for ransom.
They have abducted dozens of people since May, and even before the latest kidnappings had already killed at least four hostages.
They are still holding an American missionary couple, Martin and Gracia Burnham.
They say they have beheaded a third US man, Guillermo Sobero, but his body has never been found.