It means to get ahead of yourself.
It comes from a soliloquy in which Richard talks about his plans once Clarence and Edward are dead, but then he brings himself back to earth, saying 'I run before my horse to market', because they are both still alive and only when they are dead can he start counting his gains. It's a little like saying 'counting your chickens before they are hatched.'