Skeletons in the closet are facts and events from someone's past which that person would prefer to keep hidden. If revealed, such skeletons could have negative consequences, especially for people with very prominent public profiles, such as politicians. The term “skeletons in the cupboard” is also sometimes used in the same way, especially in regions of the world where British English are spoken.
In addition to being used to refer to individual secrets, this phrase may also more generally reference family secrets. Many families have a few skeletons in the closet, which can vary in scope from Nazis in the family tree to illegitimate children. Older members of the family may have a desire to keep such facts hidden from the younger generation, out of a sense of shame or a desire for family harmony. In some instances, a family works together to conceal such secrets, out of a desire for privacy and to avoid having the past dredged up.
By their very nature, skeletons in the closet tend to be harmful, because of the secrecy involved. There are certainly cases in which secrets should not be aired to the general public, but sometimes people might find it easier to be open about sordid past events before those events can be used against them. For example, some politicians have openly stated that they have experimented with drugs in their youths, in an attempt to thwart later attempts to discredit them with examples of drug use.
As a general rule, skeletons in the closet emerge eventually, as the truth will out, even after several generations of clever concealment. One hopes, of course, that people only have figurative skeletons in the closet, rather than real ones. When it becomes apparent that a secret is going to be outed, some people prefer to out themselves, in the hopes of reducing the associated fallout. A determined effort to conceal such a secret can sometimes just draw attention to it, turning the unveiling into an even bigger production.
Some people excel at unearthing skeletons in the family past; investigative reporters are one well-known example. This skill can be extremely useful in situations like political campaigns, as investigators can be used to dig up dirt on the other side, and to see how well the candidate's skeletons are buried.