I don't think I was ever 12 so I can't answer. lol
Well my response is gonna be TMI/blunt, but its the only way to talk about it...
When I was that young my dad had the talk with me about 10 I think. Well more so waking up with "stuff going on". And honestly at that age you aren't lusting or thinking of anything, your literally get excited for no real reason and just do what seems natural.
Now doing it in the shower, I'll just say if hes doing it at the end of the shower, theres a chance as the water drains the floor will be.... sticky. Which yes, is gross and dangerous because its slippery.
Maybe just talk with him (unless the dad can, not sure since your profile says your single) but don't tell him you caught him MB. Just tell him you want to have a talk with him that may be akward but it needs to be done.
Just tell him hes at an age where may do "things" with his body that are natural. Tell him if he wants to do them, to do it privately, like in his room. And, again being blunt put kleenex around his "you know". Keeps it clean and simple. Tell him (again don't act like you know where he did it) there are other places he may want to do it, like a bathroom, but not to do it there because other people use it and its not sanitary.
And PLEASE remind him to NOT eventually do it while thinking of things he shouldn't. The urge eventually may show up. After a year or two I started doing it to national geographic magazines. Then eventually I needed inappropriate content to look at. :/ Aside from being super sinful when lusting, it will screw up your mind for later when you marry. Because you won't be able to "get happy" because your so used to the wrong type of stimulus. Sorry if thats alot to take in, I just wish my parents had talked to me more about the subject before I rotted my mind.
Thankfully I'm done with that stuff now and happily married. Side note, I hope he never uses shampoo. If your a guy you will know why. >.>