The AU mission (Amisom) says it repulsed the attack, killing 110 militants.
Residents in Halgan told the BBC they had heard a huge bang followed by a heavy exchange of gunfire.
Amisom supports the government as it fights to regain control of the country from al-Shabab.
In a series of tweets it has said its soldiers, alongside troops from the Somali army, "drove back the attackers who are now on the run with the joint forces in pursuit".
Ethiopia has denied that any of its soldiers were killed.
Africa Live: More on this and other news stories
It is not possible to verify the various claims about how many people were killed.
Somali Security Minister Abdirizak Mohamed Ahmed told state-owned Radio Muqdisho that officials had counted the bodies of 240 militants outside the base.
He said that nine Amisom soldiers had lost their lives.
He said that the attackers had driven a car bomb into the base.
Ethiopia is one of five countries contributing troops to the 22,000-strong mission and this is the first time an Ethiopian-run Amisom base has been attacked.
Halgan, 260km (161 miles) north of the capital, Mogadishu, is part of the area of Somalia patrolled by Ethiopian soldiers.
In January, al-Shabab targeted a Kenyan base in el-Ade, southern Somalia.
It said it had killed more than 100 soldiers but the Kenyan authorities have not confirmed the death toll.
Al-Shabab has also attacked Amisom bases run by troops from Burundi and Uganda.
Somali Islamist militant group al-Shabab says it has killed 60 Ethiopian soldiers in an attack on an African Union base in central Somalia.