It sounds like you are referring to compulsory education.
By and large, compulsory education appears to be a trailing indicator of heavy literacy, not a leading one. In other words, once a critical mass of people in a society become literate, it becomes seen as a necessity to function in society (either for the child, for society, or a combination of the two, I think is up for debate).
There's a really nice interactive graph of world literacy rates at Our World In Data that I've screenshotted at 1870 below.
Why 1870? This is not only the first year we have data for the US, but also one of the last datapoints before a lot of the nations on this graph began compulsory education. Specifically, for the 5 countries that gave data that year graph, the compulsory education enactment timeline was:
- The USA enacted it by state. The only states that had CE in 1870(PDF) were Massachusetts, DC, and Vermont.
- Scotland made education compulsory in 1872. England and Wales didn't have it until 1880.
- France made it compulsory in 1882.
- Sweden made it compulsory 1842.
- Italy got it in 1869
So of the 5 countries listed on that graph popup, only Italy had yet to achieve at least 2/3rds of their citizens literate before compulsory education was enacted. Sweden was the first of the 5 to enact it, but it was also already the most literate of the 5 at the date it did so.