See addenda below! When people ask: "To what do you attribute your long marriage?" I usually answer "Inertia". There is more truth to that than might initially meet the eye, but it is only one of the reasons.
Firstly, when you agree to wed, you must believe that you are marrying a friend, with whom you can not only tolerate spending the rest of your life, but with whom you will be contented. Most of us 'think' that at the time, but a firm belief is required, in my opinion, which suggests that you have really thought about it before deciding to accept the proposal. It is desirable to have ideals in common, as well as similar thoughts on how to conduct your finances, religious preferences and raising your children. One should talk about these things beforehand.
Secondly, you must be dedicated to staying married. If your idea of marriage is "Oh, well, if it doesn't work out - we'll just get a divorce", then your future will surely hold that as a prospect, if not a fact. A firm resolve to make it work is to be desired above all.
Thirdly, compromise is the watchword for a successful relationship (marriage or otherwise). If one of you is so self-centered as to insist on always having things your way, the relationship is doomed to failure, or to a hellish existence if you stay together. (I can hear my husband laughing as he reads that - assuming I let him!). Remember that a marriage is seldom a 50-50 proposition. It is often 90-10, or 30-70, and the larger number will not always be on your side. Learn to live with that.
Fourthly, a sense of humor is a necessity, as is a willingness to say "I am sorry" and show that you mean it.
The caveat: All of the above flies out the window if you are being verbally or phyically abused. No one should stay in a relationship where there is not a true spirit of love, respect and compassion for the other person. Try counselling, or anger management if need be, but do not allow yourself to feel trapped in a marriage where you are not respected. If you have any idea that you have made a mistake in your choice of spouse, do not bring a child into the world expecting that to magically solve all your troubles, for it will only compound them.
I am no expert (again my husband is laughing!), but these are ideas that have worked for us. My husband and I were fortunate to be the children of parents who also stayed married a long time, and that certainly works in our favor.
An additional note: Do not let this lead you to thinking it was all a bed of roses; I can assure you it was anything but! We had hard times, slammed doors, shouting matches (which happen nowadays too) and there were periods when due either to his work travel or a shared intractability, we hardly spoke to each other. But the initial vows we made were not forgotten, and we were still committed to each other and to the marriage.
I neglected to tell you one of the more interesting aspects ofit all: we met in January of 1964 and married in early July of 1964. We hardly knew each other, really. I don't recommend that you marry so swiftly, but since I did, I can hardly set up parameters for you, can I?