It seems like you also realise that you have not acted in the right way, it is good to recognise when we have done something wrong and to seek to make amends. All Christians continue to sin in one way or the other, and so we all need to be aware of when we have done wrong and seek to deal with that.
The simple answer is that asking God for forgiveness is like asking a friend or parent for forgiveness - you talk to them. Pray to God, tell him you recognise that you’ve done the wrong thing, ask him to forgive you.
Two other thoughts occur to me
Firstly, an implication of recognising we have done something wrong is to commit ourselves to trying to fix up the consequences of our wrongdoings (ie are there any people you need to apologise to for anything you did while drunk? Do you need to talk through what happened with the person you had sex with?) and also to work hard at not repeating our sin.
It may be worth thinking about why you got drunk and had sex. You mentioned that you’d been through a rough time - Were you feeling down? Were you hanging around with friends who drink a lot? Was this something you may have done without consideration before you started believing in God? Whatever may have contributed to tempting you to get drunk and having sex, it would be good to recognise and deal with those factors, so you don’t get tempted to repeat these actions you now regret. Talking with a few other trusted Christian friends may help you come up with some practical suggestions. Jesus also taught his followers to pray that God would give us strength to resist the temptation to do wrong.
Secondly, if you haven’t already, it may be worth touching base with a doctor about any possible medical implications of having had unprotected sex. If you are pregnant you may also want to talk through what to do with a mature Christian who you trust.