First, note that the correct sentence is “Ils n'ont plus qu'à attendre le prochain”. The word a is the third person indicative singular of the verb avoir, the word à is a preposition. The noun train is masculine, thus it's “le prochain”; for a feminine noun it would be “la prochaine”.
Regarding the negation, recall that the basic form of negation in French is ne … pas. The adverb pas can be replaced by other adverbs to indicate a specific form of negation: jamais = never, rien = nothing, plus = no longer, … It's possible to combine multiple adverbs, e.g. “ne … jamais rien” = “nothing ever” or “never anything”, “ne … plus rien” = “no longer anything” or “nothing any longer”, …
In French, “only” can be expressed with a form of negation: ne … que. Think of it as “nothing except …” or “nothing but …” or “nothing other than …”.
Je n'entends que les oiseaux qui chantent. (I hear nothing but the birds singing.)
Il n'y a qu'un train par jour. (There is only one train per day.)
This can be combined with other negation adverbs.
Il n'y a jamais eu qu'un train par jour. (There has only ever been one train per day.)
Depuis le changement d'horaires, il n'y a plus qu'un train par jour. (Since the service schedule change, there is only one train left per day.)
Independently, there is an idiom “n'avoir qu'à”. “X n'a qu'à faire Y” can have several slightly different meanings: it can mean that X only needs to do Y (in order for something else to happen), or that it is enough for X to do Y, or that X should do Y, or that the only solution is for X to do Y.
The sentence “Ils n'ont plus qu'à attendre le prochain” uses this idiom in the sense “the only solution”. The only solution, now that the previous train has departed, is for them to take the next one. The adverb plus indicates that the statement is relative to some past event. The contrast is slight, but there is a difference between “Ils n'ont qu'à attendre le prochain” and “Ils n'ont plus qu'à attendre le prochain”. Without plus, the meaning is more “they should wait for the next one”. With plus, the meaning is more “the only solution is for them to wait for the next one”, because plus anchors the statement to the cause of the problem which is that they've missed the previous train.