a woman who dresses or behaves in a way that is considered tasteless and sexually provocative
John Camden Hotten defined this word in Dictionary of modern slang, cant, and vulgar words (1864 edition):
a term of approval applied by the London lower orders to a young woman for whom some affection is felt. The expression is not generally employed by the young men, unless the female is in ‘her best,’ with a coloured gown, red or blue shawl, and plenty of ribbons in her bonnet—in fact, made pretty all over, like the jam tarts in the swell bakers’ shops.
The word therefore was originally a term of endearment, and what most probably happened was an ordinary semantic extension of tart, from the literal sense of a small open pastry case containing a sweet filling to the figurative sense of a sweet woman. This semantic extension would have been quite similar to that of terms such as honey and sugar in English, and chou (round cream bun) in French.
This seems to be confirmed by the fact that in his English-German glossary Londinismen: Slang und Cant (1887), Heinrich Baumann wrote the following (the translation of the German text is in square brackets):
Tart (Torte [= gâteau]) scherzhaft [= humorous]: a jam tart: ein zuckersüßes Mädchen [= a girl as sweet as sugar]; my tart: mein Schätzchen [= my darling]; the tarts: die Mädels [= the lasses].
Jam (Eingemachtes [= preserves]) scherzhaft [= humorous]: süßes, liebes Geschöpf [= sweet, dear creature]; she’s real jam: es ist ein süßes Mädel, der reine honig [= she’s a sweet lass, pure honey].
In Slang and its Analogues Past and Present (1904), John S. Farmer and W. E. Henley defined tart as meaning:
Primarily a girl, chaste or not; now (unless loosely used) a wanton, mistress, ‘good-one’.
And among the numerous synonyms of tart, these authors included “buttered-bun”, “jam” and “jamtart”.
Brewer’s Dictionary of Phrase and Fable. Revised & enlarged (undated edition – 1953?) contains the following:
As applied to a harlot or girl of loose sexual morals this word dates back to Victorian times and in all probability is a contraction of “sweetheart.”
Merriam-Webster Dictionary online suggests a slightly different origin:
earlier slang, girlfriend, probably short for jam tart, rhyming slang for sweetheart.