Here's one theory:
SKELETON IN THE CUPBOARD OR CLOSET - "A domestic source of worry or shame that a family conspires to keep to itself. Every family is said to have at least one. A story goes that someone without a single care or trouble in the world had to be found. After long and unsuccessful search a lady was discovered who all thought would 'fill the bill,' but to the great surprise of the inquirers, after she had satisfied them on all points and the quest seemed to be achieved, she took them upstairs and there opened a closet which contained a human skeleton. 'I try to keep my trouble to myself,' said she, 'but every night my husband makes me kiss that skeleton.' She then explained that the skeleton was that of her husband's rival, killed in a duel. This expression was given literary use by (William Makepeace) Thackeray: 'And it is from these that we shall arrive at some particulars regarding the Newcome family, which will show us that they have a skeleton or two in their closets as well as their neighbours.' The Newcomes, ch lv (1853-5)." From "Brewer's Dictionary of Phrase and Fable" revised by Adrian Room (HarperCollinsPublishers, New York, 1999, Sixteenth Edition).