While the NOTAM system was down on the morning of January 11, 2023, was there a way for medical flights to take off legally and safely?
Both "legally" and "safely" would depend on your point of view and the specifics of each individual flight.
At its core, a ground stop is one tool in the Traffic Management Initiative toolbox; controllers implement ground stops in accordance with JO 7110.65 Chapter 4 "IFR" Paragraph 4–3–5:
TMIs are generally thought of as applying to IFR aircraft only; it is common practice for IFR aircraft facing a lengthy EDCT to elect to depart VFR and remain below Class A airspace all the way to their destination, for example. However there is historical precedent for a VFR ground stop: on September 11, 2001, a message was issued to Air Traffic facilities saying:
GROUND STOP ALL TFC ALL DESTINATIONS ... THIS INCLUDES LOCAL FLIGHTS / IFR / VFR / MILITARY FLIGHTS ... NO ONE FLYS
Again: this was a message sent to Air Traffic facilities, not pilots. A VFR departure from a non-towered airport would not have known about this ground stop. But a VFR aircraft at a towered airport would have been told not to depart, and would have had to comply with that instruction per 14 CFR 91.123(b).
In the case of the GS on January 11, 2023, the message was:
GROUND STOP ALL DEPTS REGARDLESS OF DESTINATION
which certainly sounds like it applies to "all departures." But just like on 9/11, this message was only sent to ATC—and because the NOTAM system was out of service, the FAA could not issue a general TFR that pilots could see during a pre-flight briefing.
Now there were additional messages sent relatively soon after the initial GS message which exempted first medevac and military flights, then VFR flights, and then IFR general aviation (Part 91) flights. But for a short while, VFR aircraft—even medevac VFR aircraft—were not allowed to depart towered airports... depending on how controllers at those airports interpreted the GS message.
As for the "safety" aspect: Pilots have a legal and moral obligation to familiarize themselves with possible hazards prior to beginning a flight. 14 CFR 91.103 requires that pilots "shall, before beginning a flight, become familiar with all available information concerning that flight." If the NOTAM system is not operating, recent updates and outages in the National Airspace System cannot be found by pilots.
The FAA seems to have decided that that information being unavailable constituted an unacceptable safety risk, particularly for airline flights—hence the general ground stop. But a medevac helicopter crew departing from a hospital and landing back at that hospital entirely in Day VMC may have looked at the situation and decided that the lack of NOTAMs did not constitute an unacceptable risk.