Timing is relevant on "bad behavior".
Once a divorce decree is signed by a judge, then everything that happened before the date of the signing can never be brought up in court again. The judge cannot "listen" to evidence that happened before the signing of the last court order. So if one party is "very bad" then don't settle and go to the judge to show the judge all the "bad evidence" you have on the other side.
How relevant is the bad behavior?
Writing hot checks is bad but generally it won't impact custody of a child.
A person that molested a child - that will impact a judge's decision on custody.
Can a person that has been in prison ever gain custody of a child?
Yes. If the person has cleaned up their act and is now a responsible citizen in the community, that person can gain custody. I was involved in a CPS mediation and one man who had been to prison gained primary custody of his child. He had worked for over 5 years at the same company, owned a small home and had nothing on his record since his release from prison.
If a person was in prison before you married and you knew it, the judge will also look at you. If you knew that the person had a "bad record" and you chose to marry and have children, then you cannot expect the judge to question your judgment.
What if he/she "hid" his past? Again, how long did you date before you married, and does it really matter now.
My husband wanted me to have an abortion when I told him I was pregnant - does that matter? No. What matters is what kind of father he is today. I actually had one mother tell me this and her child was 15 years old. I told her to never say it again because her child might hear her hurtful comment. Plus, he said it one time! He had been supportive of her pregnancy after he settled down. He had provided for the family for the past 16 years. This is totally irrelevant.
Plus many men "freak out" when they learn that a woman is pregnant - it's how they behave after the baby is born that is relevant.