It's going to depend how concerning the messages were.
Would you go to the school if they were aimed at your 10 year old?
I'm not sure what school can do if parents allow their 10 year olds to have WhatsApp unless it's a safeguarding issue. So I assume the girl's parents will request your son is kept away from their daughter, and if the messages are concerning enough social services might be called because they will have concerns what your son is being exposed to.
As for your son, you need to talk to him about where these thoughts came from, what has he heard, seen and where, from whom. That once messages are sent they can be made public nothing is private in the end, just because you have deleted the messages doesn't mean they aren't already screenshotted by someone else, that, depending on the severity, the police can turn up and demand his phone, laptop, as a safeguarding issue for him as much as anyone.
But there is always leeway in these things, if it was "I want to stick my tongue down your throat" that's one thing v "I want to fuck you from behind". There's a big difference.
Exposure to adult conversation happened quite quickly to ours in secondary, so around 12. We handle it (because they are still in that environment) by brutal honesty with them, e.g. "if a picture of your knob ends up being sent then it's effectively child pornography and you will have to hand over your phone and mum and dad will be questioned" with "and really sweetheart who wants to see a picture of your knob anyway think about it please"
We can make them laugh whilst talking about this stuff and usually "giggle and go oh no and then what happened" when they tell us incidents. Before we react.
Basically keep lines of communication open. He's messed up, he's 10, it's not the end of the world. But you need to get him to talk to you as well as punishments.