Well it depends on what you mean by ‘just’, and it depends on what you mean by sex. If a female has unprotected vaginal sex with a male she can take emergency contraception (known as the morning after pill). The emergency contraception pill can be taken up to 72 hours/three days after having sex. Emergency contraception should be taken as soon as possible to increase effectiveness. The sooner a female takes emergency contraception, the better. It can reduce the chance of pregnancy by up to 89 per cent.
BUT REMEMBER emergency contraception provides no protection against HIV or other STIs/STDs. So you could both be at risk and it’s important to get tested!
For more questions on sex and contraception you can find the answers or submit your own question here