As mentioned earlier, there are two types of medals - campaign medals and valour medals.
To qualify for a campaign medal you have to have been in theatre for 28 days. So if a solidier goes out of a period less than 28 days they will not get a campaign medal, even if they've been under gunfire, injured, etc.
The valour medals, no need for explanation, you have to be nominated for one.