It comes from a story of a man staying at an inn who let one shoe drop loudly to the floor when he undressed for bed. He took the other shoe off quietly and settled to sleep. In the middle of the night he was woken by the man in the room below who had been lying awake all that time waiting for the other shoe to drop, and getting more and more worked up about it.
The meaning is simply waiting for something to happen which you believe is an inevitable consequence of something that has already happened.