Earning a medal in Star Wars: Battlefront II depends on which medal you're after. Some are tied to specific actions, and they can vary from platform to platform. You might need to score a number of headshots as a sniper, get a certain number of kills with a particular weapon in a single life, or rack up enough points in one life.
A reliable method is to open the screen that shows how many medals you have; it usually explains how to earn each one. If that doesn't clear things up, checking a walkthrough or guide for your specific platform should point you in the right direction.