Mary is the twin sister to Billy Batson (aka Captain Marvel). Originally created in 1942 by Fawcett Comics her first appearance was in Captain Marvel Adventures #18. Like her brother, she gains her powers every time she says the word “Shazam.”
Sarah Primm (the lady that nursed the two twins) secretly switched Mary with another child that died so that Mary would be raised by the wealthy Mrs. Bromfield. It was several years later, that the truth would be revealed when a dying Sarah Primm informed Billy of his twin sister. His only link to finding her was a broken locket.
As fate would have it, Billy (as Captain Marvel) does find his twin sister and saves her from being kidnapped. He then reveals his secret to her turning back to Billy Batson. There reunion was shortlived as the kidnappers returned and captured the twins. As Billy lied gagged and tied, Mary accidentally says the word Shazam and transforms into the heroine equivalent of Captain Marvel.
Mary Marvel’s first appearance is in Captain Marvel Adventures #18.