A marble jar is where I keep my marbles... so that they are not lost.
To 'lose one's marbles' is to lose one's mind. This late 19th century American meaning has now been superseded by the many variants of 'one brick short of a load', 'the light's on but there's no one at home' etc. In those later expressions the literal meaning of 'load', 'light' etc don't have any special significance - the point is that the person in question has, as in another earlier variant, 'a bit missing'. Perhaps though 'marbles' meant 'mind' or 'wits' before 'lose one's marbles' was coined. That's worth investigation at least, so let's have a go.
The word 'marbles' has had many meanings. Of course, marbles are the little clay or glass balls that children use to play the eponymous game. From the mid 19th century 'marbles' was also used to mean 'personal effects', 'goods', or more generally 'stuff'. This derives from the French word 'meubles', which means 'furniture'. From the 1920s onward two US expressions have become established - 'to pick up the marbles' and 'to pick up one's marbles'. These mean 'to carry off the honours or prizes' and 'to withdraw from activity or game and cause it to cease' (like the UK variant 'take one's ball home'). 'Marbles' also meant testicles and has been used that way since at least the mid 19th century.
Despite these many meanings, there doesn't seem to be any reason to connect any of them to the 'losing one's mind' meaning. It has been suggested that the expression derives from the Elgin Marbles - the collection of sculptures, some from the Parthenon Frieze, which were taken from Athens by Lord Elgin in 1806. The supposition is that the expression derives from the loss of the artworks by the Greeks, or their subsequent loss at sea when the ship that was transporting them sank - although they were later recovered. Again, there's no evidence to support this idea.
It's more likely that 'marbles' was coined as a slang term meaning 'wits/common sense' for no particular reason. This uage begam in the us in the late 19th century and the Ohio newspaper The Portsmouth Times, reported a story in April 1898 that used marbles that way:
"Prof. J. M. Davis, of Rio Grande college, was selected to present J. W Jones as Gallia's candidate, but got his marbles mixed and did as much for the institution of which he is the noted head as he did for his candidate."
By 1927, an edition of American Speech defined the term unambiguously:
"Marbles, doesn't have all his (verb phrase), mentally deficient. 'There goes a man who doesn't have all his marbles.'"
Welcome to my marble jar - Michele