'A skeleton in the closet' undoubtedly originated as an allusion to an apparently irreproachable person or family having a guilty secret waiting to be uncovered. The close-at-hand domestic imagery of a closet or cupboard gives a sense of the ever-present risk of discovery. What isn't clear is whether the origin of the phrase lies in fiction or with real life, so to speak, skeletons.
Two great sources of distress are the danger of contagion and the apprehension of hereditary diseases. The dread of being the cause of misery to posterity has prevailed over men to conceal the skeleton in the closet...
Several months later, it arrived on the doorstep of Louisville’s Southern Baptist Theological Seminary, where it was — for the better part of 120 years — a literal skeleton in the closet.