One common cause could be a child being too shy to ask to go to the bathroom in time. Maybe they're new to the school environment and don't feel comfortable speaking up. Another cause might be a medical issue that the child or the school isn't fully aware of, like a bladder infection. Also, if the bathroom facilities are far away or in short supply, a child may not be able to reach them quickly enough.
Some kids may have a small bladder capacity which they or the teachers might not be aware of. If they drink a normal amount of fluids, it could still lead to an accident. Also, in a large school with a lot of students, there might be long lines for the bathroom. A child waiting in line may not be able to hold it in. Moreover, if a child has special needs that are not properly accommodated in the school's bathroom facilities, like for example, a child with a physical disability that makes it difficult to access the toilet quickly, bathroom accidents can occur.
Well, sometimes kids get so engrossed in their activities, like during an exciting game at recess or an interesting class project, that they forget to go to the bathroom until it's too late. And there could be cases where there's some sort of bullying in the bathroom that makes a child reluctant to use it regularly, leading to an accident. Additionally, if the school's bathroom schedule is too rigid and doesn't account for individual needs, that can contribute as well.