I worked in childcare and found that quite often toddlers learn that they can hit and get a reaction. i think the best thing you can do is to, obviously, discourage it right from the start. Telling him 'we dont hit our friends/family/mummy/brother' etc and leave it at that. Hes not to young to use time out either, tell him 'if you hit, you can sit by yourself'. everything needs to be black and white so he knows that whatever action he takes there will be a consequence and the consequence is always the same.
Also dont forget to praise him when he doesnt hit or refrains from hitting. children learn a lot from praise and sadly, it's often forgotten!