it comes from old spanish coins that they would cut into eight pieces, or bits.
I learned that after watching one of the pirates of the Caribbean movies and googling pieces of eight.