Mr. Trump’s test took many officials by surprise. Vice President Mike Pence, a senior administration official said, learned only on Saturday morning that Mr. Trump had been tested. At the news conference, Mr. Pence was left to handle questions about the president’s decision, some of which he did not appear to know how to answer.

Mr. Pence also indicated that he might soon follow the president’s lead. “I’m going to speak immediately after this press conference with the White House physician’s office,” he told reporters. The physician, he said, had previously advised him that he did not need testing.

Mr. Trump, who sees strength as the most important quality someone can project, has often equated illness with weakness. Over the past week, he had resisted testing, disregarding the advice of Dr. Anthony S. Fauci, the director of the National Institute of Allergy and Infectious Diseases, who has recommended tests and self-quarantine for anyone who has stood next to someone who had tested positive.

Despite having the imprimatur of the highest level of American government, Dr. Conley’s decision not to recommend a test for Mr. Trump, or any sort of isolation, was at odds with the advice of other physicians, as well as medical experts on the administration’s own coronavirus task force.

The standard protocol is to ask people exposed to a known coronavirus case to stay home, to monitor their own health and to refrain from their regular activities for 14 days, and to get tested if they develop symptoms, said Dr. Thomas M. File Jr., the president of the Infectious Diseases Society of America.

As a head of state leading the nation through a turbulent time, the president has a singular responsibility to safeguard his health, said Lawrence O. Gostin, a professor of global health law at Georgetown University. By letting a week go by before agreeing to a test, Mr. Gostin said, Mr. Trump “gives exactly the wrong message to the public, and puts himself and his cabinet at risk.”

But that decision was in line with the course of action Mr. Trump preferred — avoiding a test whose results could make him face a reality he might not want to acknowledge. It also followed a pattern of Mr. Trump’s career in politics: releasing memos and statements from medical professionals who are willing to say whatever he wants them to say about his health. Dr. Harold N. Bornstein, Mr. Trump’s personal physician during the 2016 presidential campaign, later admitted that a flattering doctor’s letter he had released was dictated to him verbatim by Mr. Trump.