Pharmaceutical giant Johnson & Johnson said Monday it has a possible COVID-19 vaccine that could be available for emergency use by early next year, stepping up efforts as government officials, Wall Street analysts, shareholders and others put increasing pressure on drug companies to end the virus crisis.

It’s the most ambitious move yet in the race to produce the type of antidote that President Trump demanded in a White House meeting with Big Pharma four weeks ago, even as his advisers said a vaccine couldn’t be available for a year to 18 months.

Yet this isn’t a typical crisis. The government is offering big money and everyone is clamoring for a cure, so Big Pharma is diving in. Manufacturers are moving up timelines, revving up supply chains and donating doses that might help COVID-19 patients but haven’t been proved to be safe and effective.

Their moves are cheering investors searching for hope on Wall Street, and good public relations are helping an industry that has been heavily criticized and hauled before Congress over price increases in recent years.

“There is a sense of public duty, and that is admirable. But also, let’s face it: It’s great publicity for the pharmaceuticals and the industry to jump in now and help,” said Jeremy J. Siegel, a finance professor at the University of Pennsylvania.

Health care companies involved in the fight led another much-needed rally on Wall Street on Monday as investors contend with the long-term toll of the crisis. Abbott Laboratories’ stock rose over 6% after it won regulatory approval for a five-minute test for COVID-19.

Johnson & Johnson shareholders, meanwhile, got an immediate boost after the Trump administration said it is jointly investing $1 billion in the vaccine touted by CEO Alex Gorsky on NBC’s “Today” program and elsewhere. The company’s stock jumped 8% as the Dow Jones Industrial Average surged 690 points.

The Biomedical Advanced Research and Development Authority (BARDA) said it is arranging phase 2 and 3 clinical trials for Moderna, a biotechnology company that is testing a rival vaccine in Seattle and making market gains, underscoring the stakes in the race to stop a disease that has shuttered businesses, forced schools to close and turned world capitals into ghost towns.

“This could be a winner-take-all situation in that the first company that gets approved by the FDA could get all the vaccine business given the urgency of the situation,” said Gerard Anderson, a professor at the Johns Hopkins Bloomberg School of Public Health.

At the same time, he said, “there are always risks when things are rushed.”

“It is important to have enough patients enrolled to make sure that the vaccine is effective on a wide range of people and that there are no side effects,” he said. “This can take time to gather sufficient patients and follow them to make sure there are no side effects.”

Mr. Gorsky, of Johnson & Johnson, acknowledged the risks and said he is trying to accomplish in five to seven months what would normally take up to five to seven years.

“That’s what we have to do in this case. We’re going to do everything possible to make sure that we have a safe, effective vaccine available in the kind of quantities that can really make a difference,” he told NBC.

Mr. Trump has been one of the biggest cheerleaders for a cure or vaccine for COVID-19, a viral respiratory disease that was discovered in December in Wuhan, China, and has killed over 2,500 people in the U.S.

The outbreak has devastated the economy, upending Mr. Trump’s plans to ride a terrific unemployment rate and a soaring stock market into the November presidential election. He hasn’t been shy about prodding drug companies to fast-track potential treatments and vaccines.

“This is something we want to get done very quickly,” he told pharmaceutical executives in a White House meeting March 2.

Beyond shareholders and the White House, pharmaceutical companies are motivated by the weight of the moment.

“There’s a general environment of great need, and the U.S. prides itself on having a big and vibrant bio-pharma industry. Now is the time to kind of rely on that to help the country and the rest of the world through this unprecedented period,” said James C. Capretta, a resident fellow at the American Enterprise Institute.

“I think they probably just feel the natural pressure to live up to the expectation. It’s not just coming from the Trump administration, but the general public and everyone else. It’s a high-stakes moment, and they feel they need to step up,” he said.

Reflecting on that spirit, Mr. Gorsky said the J&J vaccine will be offered on a not-for-profit basis in the U.S. and around the globe.

Indeed, winning the race to a vaccine won’t bring a financial windfall, in part because the population will develop “herd immunity” over time as people catch the coronavirus and recover from COVID-19. Also, the virus might mutate and reduce the vaccine’s effectiveness.

Still, there are plenty of incentives for companies.

Gilead Sciences in recent years has clashed with Congress and other parts of the federal government over the costs of its hepatitis C and HIV drugs. Now its drug remdesivir is mentioned from the White House podium as a potential treatment for COVID-19.

“I think investors need to recognize that while [movement on a vaccine is] exciting for the market and for certainly humanity, none of these companies are going to significantly profit from that,” Michael Yee, a Wall Street analyst at Jefferies, told CNBC. “Our primary advice for investors is to be focused on diversified companies like Gilead or Regeneron.”

Regeneron Pharmaceuticals is testing a COVID-19 treatment as part of a broader portfolio.

Officials in Washington, meanwhile, are exerting pressure behind the scenes through agencies such as BARDA and the National Institutes of Health.

“It’s primarily about nudging companies who can work in this field rather than direct pressure. The fact that BARDA is partnering with J&J is probably the best evidence of institutional and financial nudging — something we’ve seen also in previous outbreaks of infectious diseases,” said Ana Santos Rutschman, a professor at St. Louis University School of Law who has studied vaccine development.

Mr. Gorsky said J&J got a head start because of its work on Ebola and severe acute respiratory syndrome (SARS), which appeared in East Asia in 2002.

“We’ve got a candidate that has a high degree of probability of being successful against the COVID-19 virus,” he told NBC. “We’ve got the production capabilities to be able to ramp up production of this in a relatively short period of time so it can become available. That’s why we’re entering into this agreement with the government.”

Mr. Trump is hailing Big Pharma’s efforts as part of a broader push to get U.S. industries to manufacture hospital gear or bolster their supply chains to keep grocery stores well-stocked. Executives from Honeywell, Raytheon, MyPillow and other companies told Mr. Trump that they are ready and willing to help win the “war” against the virus.

“The private sector has been amazing, what’s happened. Really amazing,” Mr. Trump said from the White House Rose Garden.

The president is also pushing for treatments for COVID-19 because vaccines take so long to develop.

The Food and Drug Administration authorized Mr. Trump’s push late Sunday to allow hospitals and doctors to administer anti-malaria drugs hydroxychloroquine sulfate and chloroquine phosphate to COVID-19 patients more broadly on an emergency basis.

While some say Mr. Trump is putting too much stock in the drugs, New York Gov. Andrew Cuomo has initiated a clinical trial in his state. The president said the drugs have been used safely for decades and there is little to lose in trying them now.

The administration accepted 30 million doses of hydroxychloroquine sulfate donated by Sandoz — the Novartis generics and biosimilars division — and 1 million doses of chloroquine phosphate from Bayer Pharmaceuticals for possible use in treating patients hospitalized with COVID-19.

Mr. Trump on Monday announced that Teva Pharmaceutical Industries had donated 6 million doses of hydroxychloroquine.

Some analysts are leery of the plan to commit the drugs to the pandemic because of shortfalls in Europe for patients who use the drugs for lupus and other needs.

“In this case, the donations strike me as misguided in volume, particularly in light of the shortages observed in countries further along in the outbreak curve,” Ms. Rutschman said. “I think that this is a reputational move fueled in part by the less relevant, but more vocal, messages coming from the White House putting an emphasis on ending the outbreak in unrealistic time frames.”

The companies say they are acting responsibly to maintain supply and safety.

“Bayer provided the donation because it was the right thing to do,” the company told The Washington Times.

Sandoz said it is donating hydroxychloroquine that has not already been allocated for other needs and will monitor incoming orders for unusual buying patterns. The drugmaker said it is delivering the medicine for clinical trials, not general use for COVID-19.

“The decision was not based on shareholder pressure,” Sandoz told The Times. “As we have shown with our pricing commitment, donations and our commitment to increasing production, we are a global citizen first.”