This is the kind of issue where a Legal Realist would say that the law isn't what it claims to be. In the US, the UK, and other common law countries, the common law of assault says that there can be no consent to assault. This legal concept has been used to treat as criminal sexual activity that is violent but has been consented to. But in the case of contact sports, we get a little mystical, if not hypocritical.
The source quoted in @Dale M's answer (R v Burstow; R v Ireland  1 AC 147) says that an assault
causes another to apprehend immediate and unlawful violence
But in the case of a rough contact sport such as football or boxing, a player may well apprehend violent contact, and even fear serious injury. A person about to be tackled in US-rules football, or punched in Boxing, or struck in a mixed martial arts bout, may quite reasonably fear quite serious injury -- such injuries do happen. The obvious difference is that such a person apprehends "violence" but not "unlawful violence". But what makes the violence lawful? Apparently the fact that it is expected within the rules of the game. In effect, we treat the player as having consented in advance to that kind of violence which is within the rules, although the laws don't put it that way. Yet if two or more people enter into an informal "fair fight" or a brawl, where each knows that violence may be expected, and perhaps is quite willing to receive as well as give attacks, the law does not exempt them, but treats them as guilty of assault and/or battery.
It seems that where the game has a somewhat formal existence, with agreed (and published) rules, the legal process (and those who administer it) treats the rules as if they were incorporated into the law, and legitimize the violence, as long as the rules are complied with.
This is a case where he true rule can perhaps be better determined from how the courts and the legal system as a whole acts, rather than from what the statute books and court opinions say. That is exactly the theory of "legal realism", which asserts that the true law is to be determined from what courts do, not what they say.
I am not sure if any of this applies to civil-law jurisdictions, or if they have explicit statutes for this case.