President Trump invoked a Korean War-era law to help manufacturers secure supplies needed to make ventilators and protective face masks, as the federal stockpile of the medical devices was running dangerously low amid the coronavirus pandemic.

Mr. Trump used the Defense Production Act in an effort to address the surging levels of patients in particularly hard-hit metro areas such as New York, New Orleans and Detroit. The federal government has distributed roughly half of its ventilators, according to an analysis by The Wall Street Journal, and has fewer than 10,000 still in hand—as the nation is projected to need tens of thousands more in the next weeks ahead.

Governors in the hardest-hit states have been struggling to meet the demand for ventilators. New York Gov. Andrew Cuomo, a Democrat, said Thursday the state had only enough ventilators in its stockpile for the next six days at the current rate of use. He said the state would provide financing to companies who need to make changes to begin manufacturing ventilators and other medical supplies.

Mr. Trump said his order would help manufacturers such as General Electric Co. , Hill-Rom Holdings Inc., Medtronic PLC , ResMed Inc., Philips NV and Vyaire Medical “secure the supplies they need to build ventilators needed to defeat the virus.”

The White House didn’t immediately respond to a request for additional detail about the order.