From what I have read, it is possible for the virus particles to stay airborne and able to infect someone for that long. But also that it takes more exposure than just one molecule of virus breathed in one time to reliably even get someone sick, and that the more exposure the more sick people get so the less exposure, the lighter case they might get. Also, it depends a lot on air flow in the apartment. If the windows are open a lot and the kitchen and bathroom fans vent to the outside, that is different than if the apartment is a tightly enclosed space that doesn't get outside air flow in any way.
The research says that most people who have gotten Covid-19 were those with close, constant contact with someone who is sick. Though Jan would not be in much danger if the only contact she ever had with Marsha was from the one-time sharing of a hallway hours later, she might actually be at higher risk than in the scenario you described, because roommates don't just share one hallway once, two hours later.
If you have a sick roommate, take strong precautions, keep the windows open, use the kitchen and bathroom fans to keep air flowing out, and get tested. (Also, I guess, hope you're in the 40% that they think might have some natural immunity due to earlier exposure to other coronaviruses. There are stories of one person in a couple getting sick while the other person does not, it is possible.)