Immediately call your kid's attention and never freak out or lose temper. Usually toddlers don't get a good grasp of how their actions affect other people or things so it's best to carefully explain by associating emotions. Like for example, if he/she kicks or hits someone, they will feel bad about it, and that's not a good thing at all.
Don't forget to ask him/her to say sorry, albeit an insincere one. This may not be useful for now as they don't really understand that they can hurt other people, but by practicing this often when there's something wrong done, it can develop into a value that can mold your kid into a better adult.