"What did you do to him?" would be more common if you were discussing how you handled a person who was causing trouble (examples 1 and 3). For instance in the New International Version and several other Bible translations we find in Jonah 1:11 "What should we do to you to make the sea calm down for us?" or variations. (KJV has "unto thee" which is definitely archaic now.)
"With" is more likely to indicate a reciprocal situation, where you do something to them and they do something to you, or you do something together. So it definitely fits situation 2, where you play tennis with someone.
However it's not entirely clear-cut. "What shall we do with you?" is common as a slightly patronising question addressed to a naughty child. It is less violent than "to you", implying that some correction or education is required. There's also the sea shanty "What Shall We Do with a Drunken Sailor?" I'm not sure sea shanties are good guides to contemporary usage, but it might influence someone to use "do with him" at least in case 1, if the person is viewed as a problem to be solved rather than just someone to be smacked or ignored.
My summary is that it's often possible to use more than one preposition in English, but often one is more common than others, and you only really know that as a native or very experienced speaker.