i got married a few months ago and I didn’t go to the mikva, and now my husband and myself are trying for kids, and its not working. Is it because I didn’t go to the mikva before my wedding?
We cannot know the ways of G-d, and I therefore cannot confirm nor deny the connection between the two.
However, your approach, which sees a possible connection, is to be admired. Ramban (commentary to Deut. 13:16) writes that one of the fundamental principles of our faith is to believe that the good things and the bad things that happen to us are not random, but rather relate directly to our deeds: if we better our deeds, we merit goodness, and if our deeds stray off the golden path, we suffer the consequences.
Going to the mikva before the wedding, and continuing to go every month, is one of the most basic elements of Jewish life. It sounds like you regret not having gone before the wedding. This is the first stage in mending a misdeed, but not the last stage. To regret (and vidui, confession before Hashem), you should add the element of acceptance for the future: accepting from now on to keep the Torah laws of family purity.
Wishing you the very best, and may Hashem guide you and bless you.