There are (as far as I can tell) two major sources of possible confusion with regards to the grammar of time-travel.
- Describing points in time and duration with respect to a point in time other than the present is complicated.
- Most of these expressions are in the subjunctive mood, describing a hypothetical world (and very similar to conditional expressions), which is a common sticking point for native speakers, let alone non-native students of the language.
Starting with your clause
If time travel were possible
this is correct.
to be is one of the more common verbs to be put into the subjunctive, and in this case we are using the past subjunctive.
The past subjunctive is always used to state things known to be false about the present, and I would go so far as to state that it is much more common than other subjunctive forms.
I would want to come back 7 years ago
There are a couple of nits to pick here. I'll start with the basic one which is not related to knowledge of English, but rather to the idea you want to express.
"would want to" could mean something from "would", but in this case I think they are the same.
In general, more words imply an attempt at greater specificity, and I would reserve "would want to" to describe hypotheticals in which we assume some impediment.
For example, "I would want to travel in time, but it would probably be too expensive."
Next up, "to come back".
"to come" is only used instead of "to go" when the subject of the sentence is moving towards the speaker.
So, "I want my cat to come let me pet her, but she ignores me." indicates that the speaker wants a small carnivorous mammal with claws to approach.
Because the speaker is "here" (now) in time, travel anywhere else in time is "going", so to speak.
This can get a little finicky, as in "Oh, when will tomorrow come?!", an exclamation that thinks of future dates as approaching "now", but in this case it's clear that we want "to go" back in time.
"7 years ago" is a little tricky, as it revolves around the precise meaning of "ago".
"ago" is used to describe a point in time specifically, as in "We met for coffee two weeks ago."
However, in the case of time travel, we're describing time like we describe distance.
It's similar to the distinction between "That house is five miles east of us" and "That house is at a point five miles east of us."
We might transplant the descriptions of distance to say "I am going five miles east", but never to say "I am going at a point five miles east of us."
We need to talk about "going to a point file miles east of us".
Likewise, we can talk about "going back to a time 7 years ago", or we can equivalently just talk about "7 years" as the distance we will traverse and say "going back 7 years".
So, we can rewrite to
I would go back 7 years
stop marrying my ex-wife
Ex-wife is a fine descriptor of the person, even though she doesn't have that status at the point in time being described.
All languages that I know of allow us to use modern names for past objects, as in "Istanbul was called Constantinople, and Petersburg was called Leningrad."
"stop marrying" is a present progressive, which (probably) isn't what you mean.
The implication is that you are continuously marrying her, even now.
The desired phrase is either "stop myself from marrying" or "avoid marrying".
These work where "stop marrying" does not because they imply that "marrying" is in the future, which (in the past) it is, rather than in the present.
Which leaves us with
avoid marrying my ex-wife
my ex-wife who will be my wife a few months after that
We need a comma after "ex-wife" to indicate that we're giving an appositive alternate description of her.
However, it's unusual to describe a marriage (event) by stating that someone is a husband or wife (a state of being).
At this point, I would strongly recommend breaking the following thoughts into a second sentence, as that makes it much easier to handle this grammatically.
If time travel were possible, I would go back 7 years and stop myself from marrying my ex-wife.
She will be my wife a few months after that
Since it's preferable to describe the marriage event to the spousal relationship, we could say
If time travel were possible, I would go back 7 years and stop myself from marrying my ex-wife.
We married a few months later
I prefer "later" to "after that" since there isn't anything specific which this is after.
"After that" would be preferable if you had a specific event or time 7 years ago to which you are referring.
For example, "I would go back 7 years, to a time just after my twenty first birthday, and stop myself..." would give us a specific point of reference at the seven year mark.
"Later" doesn't carry any indication of a specific point of reference, so I think it's slightly better in this case.
since we got a really terrible marriage
If we follow my above advice and use multiple sentences, this won't work as a subordinate clause with "since" anymore because the bad marriage explains you wanting to stop yourself rather than the fact that you married several months after the point in time to which you want to return.
I think you can safely say "and" here, since it's clear from the ordering and proximity of these sentences that this is an explanation of the preceding sentence.
"got" is a verb which typically indicates that you received something from someone else.
Even when used intransitively, as in this case, it implies some type of transitive action.
The more common case, when describing a shared experience like a marriage, is to use a similar intransitive verb: "had".
"We had a really terrible marriage" is better because it doesn't indicate that the marriage was given and received by multiple people, only that it was experienced, or "owned" in a sense.
That makes the final phrase
and we had a really terrible marriage.
We can go a step further, since "we" is the subject of the preceding clause, and omit the "we" here to make a compound predicate.
If we do so, we must not precede the "and" with a comma, in order to indicate that "and" is joining only verbs, not full clauses.
The final result, after these rewrites is
If time travel were possible, I would go back 7 years and stop myself from marrying my ex-wife.
We married a few months later and had a really terrible marriage.