A skeleton in the closet (or cupboard in British English) is a secret from the past that would cause embarrassment or damage if revealed. Politicians have skeletons in the closet. Old families have skeletons in the closet. The implication is that the secret is serious enough to have been deliberately concealed — not just an oversight, but an active cover-up.
The 19th century saw a genuine conflict between medical science and public morality around the use of human cadavers. Anatomists and medical students needed bodies for dissection, which were legally hard to obtain. Body-snatching from graves was common. It is plausible that some physicians kept dissected skeletons hidden at home. The Gothic literary tradition of the era also made skeletons in confined spaces a vivid image for hidden horror.
The phrase appears in English from the early 19th century. William Makepeace Thackeray used a version of it in 1845. The British form 'skeleton in the cupboard' and the American form 'skeleton in the closet' diverged along with the general British/American vocabulary difference ('cupboard' vs 'closet' for a storage space). Both are now in widespread use.
The difference reflects the general vocabulary split between the two varieties of English. 'Closet' in 19th century British English meant a small private room, while Americans adopted it for built-in wardrobes and storage spaces. British English retained 'cupboard' for storage furniture. Both phrases entered the respective vocabulary and the metaphor remained identical.
No — it applies to any person, organisation, company, or institution. A corporation's skeleton in the closet might be an old environmental violation. A politician's might be a past indiscretion.