M.T.
Hello A.,
At almost 2, my suggestion would be as soon as he slaps, or as soon as you see his hand starting to come up, take him by the hand, trot him right over to the time out chair. Strap him in if need be. Leave him there for 1-2 minutes. Don't discuss why you are taking him there. When the time is up and you are releasing him, that's when to tell him, "You may NOT hit and if you do, you will sit in the chair again." He may not get it the first time, at his young age, but that's the best way to handle.
You can't explain things to a child too young to understand reason (reason come at 4-5 years). He doesn't need a reason. He just needs to know that what he's doing is not allowed and that he can't hit people. He isn't impolite, he is misbehaving and he does not yet know that you don't hit when you are frustrated, so you must teach him. Good luck. Many kids go through something similar!