I can't translate that sentence, “hail to the king”. I've found something like “greetings to the king” but is this correct?
Nowadays, among it's meanings it has this one:
The Archaic usage is signalled as follows:
Considering this, we can say that "Hail to the King!" can be both a way to express acclaim, praise to the King and express greeting.
But we even might be able to say that it can be both together. Deciding which one of these is the correct meaning depends on the context, as it usually happens with words with different acceptions.
The Etymology is this one:
which is related (it surprised me a bit) with Whole and its etymology:
You need only look up the definition of hail:
In this case, the second definition is most appropriate, although the first may apply as well.
Perhaps the "to" in "hail to the king" is confusing you though -- hail can also serve as a noun denoting the act of hailing, so there's an implicit imperative here: "give your hail to the king."