Note: I'm a department chair at a US university. The following represents my thoughts about your question assuming you are in the US. I will stick to comments pertaining to university policy. I am not a lawyer and am unqualified to offer any legal advice of any sort.
What do I do? How do I make this right? I'm sure this is bad, but just how bad?
This is awkward, but if indeed you are telling the truth and you didn't realize the person you had sex with was your student at the time it happened, and assuming it was consensual and both of you are of legal age, I don't think it's that bad, if you now proceed to handle the situation correctly and with maturity.
The important thing (and I mean really, really, really important) is that you must immediately act to remove yourself from any position of authority over the student to avoid ending up in hot water over what is certain to be (if you fail to act as I am suggesting) a pretty bad violation of university policy, and potentially even legal trouble. That means speaking to the instructor for the class, telling them honestly exactly what happened (yeah awkward I know), and asking for their guidance about what needs to be done. (It's a good idea for that request to be documented in writing/email.) The department chair will likely need to become informed of the situation as well. My guess is they will either have to remove you from your role as TA for the class, or arrange for the student to switch to another TA if that is a practical option, and find ways to ensure you are not involved in grading or other assessments related to the student in question.
If the instructor and chair are sensible people, I don't expect that there will be any disciplinary action or other formal repercussions to what happened, although you should certainly expect some unpleasant discussions, possibly having to be interviewed by campus officials who handle sexual harassment and discrimination, receiving unpleasantly-worded memos counseling you about university sexual harassment policies, and similar headaches. It's also quite possible that the incident will cause the instructor for the course and/or the department chair (hopefully no one else in your department will need to learn about what happened) to form negative opinions about you. As I said, if they are reasonable and professional people they will keep those opinions to themselves and move on.
Finally, if the people who handle the incident are not reasonable people, well, all sorts of things may happen, so you'd better make sure you protect yourself against unfair treatment by not committing any missteps that could end up making your situation worse. Such missteps may include trying to keep the incident secret from your department; telling about it but lying about some details (out of embarrassment or because you think those details make you look bad) or omitting important details; or any other immature/unethical/foolish behavior. Ultimately, as I said, you have a reasonable case to argue that you essentially didn't do anything (at least not knowingly, and not so far) that violates any university policies, so if you handle this with maturity chances are you should be fine.