Friday's attack at the Dadaab refugee camp was the first abduction of foreigners from Kenya since the east African country sent troops into Somalia in October to crush al Shabaab, an al-Qaeda-linked militant group.
A Kenyan driver was shot dead during the kidnapping. The four are staff of the Norweigan Refugee Council (NRC) and come from Canada, Norway, Pakistan and the Philippines.
Col. Abduallahi Moalim said Somali government soldiers in the Lower Juber region that borders Kenya stopped a vehicle carrying supplies for the attackers on Sunday.
The army seized three of the occupants who directed the force to the hostages, he said. They were being held near the border between the towns of Diff and Dhobley.
“Our forces have rescued the four aid workers kidnapped from Kenya in an overnight rescue operation,” Moalim told Reuters. ”They are healthy and unhurt,” he said.
Col. Cyrus Oguna, spokesman for Kenya's military, said the two forces launched a joint operation after receiving intelligence as to the hostages' whereabouts.
“We have them in our hands right now. They are receiving medical attention. They are exhausted,” he told Reuters. “There was also a gunfight during the rescue and one gunmen was killed and two escaped.”
The NRC declined to comment but said it would be releasing a statement shortly.
Kenya deployed troops in the Horn of Africa country days after two Spanish women working for Medecins Sans Frontieres were kidnapped at Dadaab in October. They are still being held.
Dadaab, about 100 kilometers (60 miles) from Somalia, was set up in 1991 to house Somalis fleeing violence in their country. It has since become the world's biggest refugee camp with almost 500,000 residents.
Besides the kidnappings, the sprawling camp has also been hit by a series of roadside bomb and grenade attacks which the Kenyan security forces have blamed on al Shabaab sympathizers.
Kenyan and Somali forces have gradually pushed al Shabaab fighters out of a number of strategic towns since the incursion in October, although they still hold the port city of Kismayu.
Analysts warn that al Shabaab may well increase attacks within Kenya as it comes under greater pressure from Kenyan and Somali troops in the south of Somalia.
Masked assailants hurled grenades at two churches in a northern Kenyan town and opened fire on worshippers on Sunday, killing at least 17 people and wounding more than 60 in the worst attack in the country since the incursion.