Both sentences are in the subjunctive voice. With the subjunctive, past and present forms can be used, but neither of them convey a sense of time. They are, in fact, largely interchangeable.
In effect, they are all subjunctive, but the inclusion of words suggesting uncertainty ("what would happen if ...").
What would happen if aliens were to visit earth?
The sentence above is the 'classic' and traditional way of forming a subjunctive sentence that you will find if you Google 'English subjunctive'. But the the subjunctive is characterized most strongly by the uncertainty of the tone of the sentence, not by inflexion of verbs per se. So it can be said in multiple other ways.
What would happen if aliens visited earth?
This is standard way the so-called 'past subjunctive' is formed for all verbs except 'to be'. Although it is called 'past', it does not convey any sense at all that the event has happened before the present. It is largely interchangeable with the present tense here, although some would consider the 'proper' subjunctive form more correct for a sentence beginning with 'what would'.
So, if one really wants to be pedantic (and I don't), it might be better to say:
What will happen if aliens visit Earth?
because that puts 'will' in the future indicative voice, along with present indicative 'visit'. The sentence is no longer subjunctive, but perfectly valid.
All these ways of saying the sentence in effect mean the same thing. It would be wrong to suggest there is any significant difference whatsoever in meaning.