The four workers from the Norwegian Refugee Council were kidnapped by gunmen from Dadaab refugee camp near the border with Somalia on Friday. A Kenyan driver was killed during the attack.
The four were then believed to have been taken into Somalia. "They were released in a joint force of Somali and Kenyan forces, during which one of the kidnappers was killed," an official said.
The four aid workers, employed by the Norwegian Refugee Council (NRC), come from Canada, Norway, a dual national from Canada and Pakistan, and the Philippines.
One has a bullet wound to the leg but they are otherwise unharmed.
"They are exhausted, they have walked far and have blisters, and one of the aid workers was shot in the leg, but otherwise they are in good health," the official said, adding they were now in the southern Somali border town of Dhobley.
"They are recieving medical attention at our base while they await transfer back to Kenya."
Mohamed Dini Adan, the Somali military commander in Dhobley, said the army had stopped the "kidnappers who were trying to hide and sneak past the army."
A Kenyan driver was killed and two others were wounded during Friday's attack.
The kidnapping was the latest in a series of attacks in Dadaab, where gunmen last October seized two Spaniards working for Medecins sans Frontieres (Doctors Without Borders). They are still being held hostage in Somalia.
A spokesman for the Norwegian Refugee Council, Rolf Vestvik, said he could not comment.