It is not mentioned in the Bible that Mary Magdalene was a prostitute.
The myth has arisen from the connection of a “sinner” who is forgiven by Jesus (Luke Chapter 7) and the introduction of Mary Magdelene; Mary of Bethany (John Chapter 11); and a Mary “…from whom seven devils were ejected”.
This myth was popularised by Pope Gregory in the sixth Century.
She whom Luke calls the sinful woman, whom John calls Mary, we believe to be the Mary from whom seven devils were ejected according to Mark. What did these seven devils signify, if not all the vices? It is clear, that the woman previously used the unguent to perfume her flesh in forbidden acts. What she therefore displayed more scandalously, she was now offering to God in a more praiseworthy manner. She had coveted with earthly eyes, but now through penitence these are consumed with tears. She displayed her hair to set off her face, but now her hair dries her tears. She had spoken proud things with her mouth, but in kissing the Lord’s feet, she now planted her mouth on the Redeemer’s feet. For every delight, therefore, she had had in herself, she now immolated herself. She turned the mass of her crimes to virtues, in order to serve God entirely in penance.