In the case of WannaCrypt0r, the vulnerability had already been fixed by Microsoft but those who were hit hadn't patched because as discussed elsewhere applying patches may break things so some postpone or ignore it. Same thing could have happened to a system running Linux.
1. A doctor opens an email on an office computer. Infection entrypoint from the internet.
2. The office computer worms it to a patient record server.
3. The patient record computer worms it to an MRI tech computer.
4. The tech computer worms it to the MRI itself. (If it's even hitting MRIs and not just tech computers.)
Each of the machines has a reason it needs to share files/data with the two layers it connects to, and there's no "bad" direct link. The worm exploited the filesharing mechanism.
A high security situation would probably implement a one-way upload from the MRI subsystem (machine + tech computer), but c'mon, lots of us work on networks with filesharing zigzags to penetrate deep in to them.