During the end of my first year of grad school we have to take a comprehensive exam (I am majoring in Microbiology and Immunology) Due to personal problems I failed my exam, now I get to retake it but I am worried that I might not have enough time to prepare well for it, especially that it's an old school type of exam where they ask very detailed questions about anything related to microbiology and immunology not just the things related to my thesis. So if I fail I get dropped out of the program. Any advice what can I do next with my career can I still find a way to continue in Academia?
First, make sure that the personal problems are settled and, if not, seek professional help if needed.
Beyond that you have, I think, only two options. The first is to beg for an extension to allow time for preparation. An extension might be possible or not. It might be more possible if people can sympathize with your problems.
The other option is to drop everything else possible and prepare. And this is likely necessary even with an extension. Don't let the door close. It will be hard to reopen.
You are in a hard place. There are no guarantees that you will be successful, but "clearing the decks" and hard work will, at least, make success more likely. No magic bullet here.
But there is no information here that allows career advice beyond a failure. You will need to evaluate your situation at that point. But make sure that the personal problems don't continue to affect your prospects.
As to the exam itself, make sure you say sensible things, even when you don't have a precise answer. Try not to say nothing for any given question.