Meaning:
The phrase expresses desperate longing or need for something. It implies that the speaker is willing to give up everything they have, even their entire kingdom, for the desired object.
In the context of *Richard III*, Richard III is in a desperate situation, facing a battle he is likely to lose. He cries out "A horse! A horse! My kingdom for a horse!" because he needs a horse to escape the battlefield. He is willing to give up his entire kingdom, his power, and his life for the chance to escape.
Modern usage:
While the phrase is rarely used literally these days, it's still used figuratively to express extreme need or desire for something. For example, someone might jokingly say "My kingdom for a cup of coffee!" when they're extremely tired.