This saying first appeared in Shakespeare's Merry Wives of Windsor where Pisol, having been refused a loan of money by Falstaff, responds "Why, then the world's mine oyster, which I with sword will open...". This quotation also clarifies the meaning of the saying - an enterprising person can open up the world like an oyster, possibly finding a pearl inside.