All Kenyan schoolgirls are to get free sanitary pads, the government has said.
It is hoped the move will improve access to education in a country where many cannot afford sanitary products like pads and tampons.
According to the UN's education agency, one in 10 girls in sub-Saharan Africa misses school during their period.
Some girls reportedly lose 20% of their education for this reason, making them more likely to drop out of school altogether.
The amendment to the education act, signed into law by President Uhuru Kenyatta this week, states "free, sufficient and quality sanitary towels" must be provided to every girl registered at school, as well as providing "a safe and environmental sound mechanism for disposal".
It comes more than a decade after Kenya scrapped taxes on sanitary products in an effort to make them more affordable.
Despite this, some 65% of women and girls still find them too expensive, according to figures cited in a 2016 report by non-profit consulting firm FSG.
As a result, charities like the ZanaAfrica Foundation have been providing sanitary pads for girls around the country.
Money must be used prudently: Anne Soy, BBC Africa health correspondent, Nairobi
The move to legislate the provision of sanitary towels to school-going adolescent girls has been well received by many Kenyans.
Since 2011, the Kenyan government has been setting aside funds to buy and distribute the commodity to girls from disadvantaged backgrounds.
In the 2017-2018 financial year, $5m has been budgeted for that purpose, up from $4m in the current year ending this month.
The new legal provision, however, requires government to provide the towels to every school-going girl who has reached puberty - it becomes an obligation rather than an option - so it will require a bigger budget.
There generally exists non-partisan political goodwill to fulfil this goal.
But the authorities will need to ensure the prudent use of that money to ensure every girls who needs the sanitary towels gets them.
School management teams will be charged with the responsibility of purchasing and distributing the towels.
The high price of sanitary products and the impact on girls' education is not just a problem in Kenya.
According to a 2014 campaign, girls are also missing school in countries like India, Nepal, Afghanistan and Sierra Leone for the same reason.
The issue has not just caused issues in developing countries.
Freedom4Girls - which usually provides sanitary pads to girls in Kenya - was asked to step in by a school in Leeds in northern England which was concerned about girls missing school.
One teenager told BBC Radio Leeds that she "wrapped a sock around my underwear" just to get through the school day.