The two former British colonies made the decision to pass the legislation following lobbying by civil society groups.
In Tanzania, where the rate of child marriage is around 37 per cent - one of the highest in the world - the move represents a “critical step forward” according to Human Rights Watch.
Early marriage deprives girls of education and opportunities and increases the risk of death or serious childbirth injuries. Child brides are also at greater risk of domestic and sexual violence.
Women’s advocacy group Msichana Initiative lodged a legal case against the Tanzania Law of Marriage Act earlier this year. The country’s high court ruled sections 13 and 17 – which allowed girls as young as 15 to marry – unconstitutional. Marriage under 18 has now been outlawed.
In Gambia, where around 30 per cent of girls are married underage, President Yahya Jammeh announced on Wednesday: "As from today, child marriage below 18 years is illegal in the Gambia…If you want to know whether what I am saying is true or not, try it tomorrow and see."
His wife, Madam Zineb Jammeh, has also voiced her strong support for banning child marriage. “We can't afford to allow child marriage to hold back our beautiful girls any longer," she said in June. "Eliminating child marriages should be our priority, to allow young girls to develop and contribute to development.”
Gambia also outlawed female genital mutilation in late 2015.
The president warned that offenders will face heavy penalties over any reported child marriages, and said "if you ... failed to report, if we know about it we will deal with you". A punishment of 20 years in prison for both the husband and parents of the girl being married was confirmed.
The move was welcomed by rights groups in Gambia but some expressed concern that jailing parents who marry off their daughters could spark a backlash. In the country, around a third of girls are wed before they turn 18.
Legislation alone will not be enough to stop girls from being married before 18, said campaign group Girls Not Brides (GNB). "It is essential to empower girls, to protect their rights and provide meaningful alternatives to marriage that are valued by communities, such as education," said Ruth Koshal of GNB.
The government should engage with local communities to try to change attitudes towards child marriage, instead of threatening families with prison sentences, said Isatou Jeng of the Gambian women's rights organisation Girls Agenda, to the Thomson Reuters Foundation.
"I don't think locking parents up is the answer...it could lead to a major backlash and sabotage the ban," she said.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies