The word Mistress is the feminine of the word master and originally was used to designate one who commanded servants. Of course this term as seemingly all terms for women, such as madam, eventually came to mean whore.
Johnsons 1755 dictionary defines a Mistress as
Queen Elizabeth I upon meeting the Archbishop of Canterbury's wife remarked “Madam I may not call you; mistress I am ashamed to call you; and so I know not what to call you”. Queen Elizabeth did not approve of clergy marrying. This indicates the term was in use as "kept woman" in the 16th century.
In closing it isn't just the word mistress but also madam, dame, hussy, miss and a slew of others that have acquired a meaning as whore at one point or another. I'm off to linguistics to find out why words for women come to mean whore.
That's a difficult question to answer, because the transition between the two meanings came both long ago, and very near the word's origin..
The word "mistress comes from the early 14th century, from the Old French word maistresse, meaning "master[1]." In it's early uses, it meant not necessarily wealth, but "a woman who employs or has authority over others."
Since the word comes from master, meaning "one having control or authority[2]," the notion of a woman having control or authority over people was easily quickly transitioned into the realm of love (e.g. she owns my heart). The OED lists this particular definition as "a woman loved and courted by a man.[no online citation]"
Even transitioning from owning property to owning a man's heart, within a century, Mistress came to mean "kept woman of a married man[1]". Which, sticking with the same jargon as the previous definitions, would looks something like "He may be married to me, but she has his heart."
I apologize if that doesn't exactly illuminate the transition as a great shift, but the transition was more of a double entendre than a big definition shift, and people have ALWAYS been good at those. Btw, if you have any more intrigue about word definitions, come on over to /r/etymology and see what you can find.
[1] Etymonline.com - Mistress [2] Etymonline.com - Master
tl;dr — Mistress = ownership. Step 1) Mistress owns people. Step 2) Mistress owns a man's heart. Step 3)Mistress owns MY man's heart.