Parents who fail to vaccinate their children in Uganda will face six month in jail, according to a new law signed by President Yoweri Museveni.
It also requires children to have an immunisation card to allow them to go to school.
The law will help the government reach its vaccination target, Health Minister Sarah Achieng Opendi told the BBC.
Some parents and members of a religious cult have refused to allow their children vaccinated, she says.
The government's vaccination campaign targets several life-threatening diseases including polio and meningitis.
In 2015, the World Health Organization estimated that 70 children out of every 1,000 will die before they reached the age of five in Uganda.
Ms Opendi told the BBC Focus on Africa radio programme that 3% of Uganda's children had not been immunised.
During sensitisation campaigns, some children had been found hidden in slums by their parents to avoid the exercise, she said.
Some religious leaders have previously been arrested but could not be charged because there was no specific law, Ms Opendi added.
The cult that refused to immunise their children is known as 666 and was growing, she said.
"It started in a few districts in eastern Uganda, but now it has spread and now we are seeing it all over the country," the minister said.
President Museveni signed the act into law on 10 March, but this has only just been made public.