Mr. Bloomberg’s route to the Democratic nomination has so far veered sharply from those of his competitors. He is skipping the first four contests in February but is aggressively contesting the array of larger states that begin voting in March.

While most Americans usually have no clue who the Navy secretary is, Mr. Spencer was at the center of one of Mr. Trump’s most explosive confrontations with the Pentagon.

In November, Mr. Trump, over the objections of senior Pentagon officials — including Mr. Spencer — reversed the demotion of a Navy SEAL commando, Chief Petty Officer Edward Gallagher, and pardoned two other service members who were accused of war crimes.

Mr. Spencer and top military leaders had sought to punish the three, arguing that leniency would affect morale, harm American troops in the field and undermine discipline. But the men were lionized by conservative commentators who portrayed them as war heroes unfairly prosecuted for actions taken in the heat of battle.

Mr. Spencer threatened to resign, and Mr. Trump and Defense Secretary Mark T. Esper took him up on the offer. The case dominated headlines in the days before Mr. Bloomberg began campaigning, and he addressed the blowup in his opening public remarks as a candidate at an event in Norfolk. Mr. Bloomberg derided Mr. Trump as a lawless leader and quoted Mr. Spencer’s resignation letter.

“I salute Secretary Spencer for not flinching from his duties,” Mr. Bloomberg said at the time. “But the fact remains, we have a president, a commander in chief, who has no respect for the rule of law and no concern whatsoever for ethics or honor, or for the values that truly make America great.”

For his part, Chief Gallagher traveled in December to Mar-a-Lago, the president’s resort in Florida, to personally thank Mr. Trump for his help, and officials close to the president have said that they want the commando to campaign alongside Mr. Trump this year.