In the US, detention does not add anything: we can generalize the principle to any time when a student is in the custody of the teacher (classroom, field-trip, sporting event...). One question, for the scenario that you describe, is whether the injury was foreseeable.
Suppose the injury is an abdominal aortic aneurysm – this is not foreseeable. The question that the court would ask is whether a person exhibiting reasonable caution and care would know that there is a possibility that the child has some condition. The details regarding this condition "not being easily noticeable" are essential to the outcome of the case. A child coughing up blood should be immediately treated medically, it is not reasonable to assume that a child who sneezes (once) is in imminent danger.
The teacher's response is also important, and again this is a very fact-intensive inquiry. A child who has a heart attack should not be told "go talk to the nurse" (let's assume that the teacher correctly notices that this is a heart attack happening), 911 is the correct (minimal) remedy. Perhaps using the auto-defibrillator also part of the reasonable standard of care for a teacher (assuming there is one, and that the teacher has been trained how to use it).
Then finally, the teacher is not liable if their actions / inactions don't cause the injury. In the case where a student suddenly dies, the fact that the teacher didn't somehow prevent the death doesn't make the teacher liable. But if the child is bleeding and the teacher decides "We can deal with this when detention is over" and the child bleeds to death in the interim, we would conclude that the teacher's lack of care caused the child's death.
The school might also be liable on various grounds, for example if the school has no nurse and has no practical way for the teacher to contact emergency medical services. Some school policy which unreasonably restricts the teachers exercise of reasonable care could make the school liable.
At any rate, "the child died" does not cause absolute liability, what confers liability is the actions and inactions of a party.