She had to have been either bitten by a mosquito carrying the parasite or exposed to blood or body tissue infected with the parasite. It’s not a communicable disease so you’re correct, you don’t “catch” malaria from another person. You “catch” it from parasites carried by mosquitoes.
Seems, then, that it likely happened in the hospital...