Grammatically, this is an intransitive verb in the imperative mood, like “Stop!” or “Listen!” However, it is used more like an interjection. We could also say, “Wait, you forgot your keys!” similar to other interjections like “Oh no, you forgot your keys!” Separating an actual command, like “Search” or “Halt,” from a complete sentence like “You forgot your keys,” though, would need a full stop, excalmation mark or conjunction. Just a comma between them would make it a comma splice.
In context, though, the speaker is not really asking the other person to wait for something. If someone told me, “Wait,” I would not expect to have to actually wait, but to be told or asked something important immediately. It is also much less rude to say “wait” than to give someone a direct order, such as “Stop!” (I would often add “please” or “could you” to a command like stop in contexts where that is not necessary with wait.)
Merriam-Webster lists this idiomatic usage as sense 5 of the verb wait (with two examples of usage).
: pause, stop—used to preface an interjected question, correction, etc.
"Wait, Mom. Wait. What did you say?" I said. "He left you what?"
— Frederick Busch
So wait, what's so bad about wanting to eat right?
— Annie Daly
This dictionary calls it an intransitive verb, and an interjection.
The Collins Dictionary does not have this exact usage, but does describe a similar one:
Wait is used in expressions such as wait a minute, wait a second, and wait a moment to interrupt someone when they are speaking, for example because you object to what they are saying or because you want them to repeat something.
The Merriam-Webster examples are closer to yours, but this is pretty similar: the speaker is trying to interrupt the other person, but from leaving without their keys, rather than speaking. And indeed, the examples of usage in Merriam-Webster are of asking one’s mother to repeat something, and interrupting someone because the speaker disagrees.
So it means to stop or pause what you are doing. In this sense, it is always followed by an urgent question, piece of news, or refutation.