if it is a criminal restraining order then you can ask the court to have it modified otherwise any time he contacts you he will violate it. You two can get married but he cannot contact or come near you.
This is just my opinion and not a comprehensive answer. You assume the risk because this answer may not apply to your situation depending on the facts.
You shouldn't be guessing. If he went to jail for two months, he probably was convicted for domestic violence. The court minutes can tell you whether there's a restraining order. Also, if you are the victim of domestic violence, you can call the district attorney's office and ask if you have a restraining order against him. If he had an attorney, he should call his attorney and ask if there's a restraining order in place. It is possible to remove a restraining order, but you need to know if there is an order in place first.
This communication does not create an attorney-client relationship. This means that I am not your lawyer and I will not appear in court simply by posting on this site. If you would like me to represent you, you must call my office, sign a written fee agreement and pay a legal fee, assuming I do not have a conflict of interest and you are in Southern California. If I respond to your question and you have follow up questions by posting on this site, I may or may not reply. This information should not be construed as legal advice. I am offering my opinion. Each person's case is unique, and that's why you should contact a lawyer over the phone for a consultation for your situation. That's why you should not rely on any response that an attorney posts on this site. I am licensed in California. I am not licensed in another state or country. I do not practice law outside of California.