To punish is to discipline or penalize someone because they've done something wrong. If you stole the cookie from the cookie jar, someone may have to punish you. Not you? Then who?
A judge will often punish a guilty defendant with community service or parole — or sometimes even with time spent in prison, if the crime is serious enough. You probably punish your puppy for chewing your shoes simply with a firm "No!" Sometimes people are punished unfairly, like how higher gas prices punish the people who can already barely afford to drive to their jobs.