'Spill' has been used as a verb with the meaning of 'divulge' or 'let out' since at least the 16th century. But how do beans come to be a part of this phrase. Read about the ideas on the origin here.
If the theory surrounding the one for the early 20th century is accurate then the meaning hasn't changed. It means to divulge a secret and usually to do so knowingly and/or with malicious intentions.