I noticed in many Karate sparring videos, they aren't wearing any helmets or mouthguards. It seems like they can get very hurt, if opponent messes up. Is there a reason why?
The WKF style sparring both of these videos display is points/touch sparring, where excessive contact is penalised (see the controversy over a recent Olympic Gold medal being awarded to a fighter who got knocked out).
Having competed in this style the risk of serious injury is very low compared even with light continuous kick boxing sparring (which similarly I don't think needs headguards) as you're really only trying to tap your opponent not actually hit them with any degree of force. Accidents/clashes do happen, but they're rare enough that the additional equipment is unnecessary.
It's important to note that there is some evidence that more protective equipment leads to higher risk - boxing is a great example of this where the heavier gloves lead to more head attacks being used (and similarly the rugby vs. American football comparison), and therefore more concussions/CTEs and long term effects on the fighter.
Outside of very light dojo sparring, gumshields would be almost universally used even in this style of sparring.
It's also important to note that this style of sparring is not indicative of all karate sparring, some clubs do do more kickboxing style stuff, and pad up accordingly, and many practical karate clubs do all-in sparring with a suitable level of protection including facemasks for headbutts etc.