A patient checks into the hospital for a routine procedure to treat an enlarged prostate. And, unexpectedly, a test done in the hospital — perhaps a blood test or an X-ray or an examination of the urethra and the bladder — finds a cancer.

Apparently, something like that happened to King Charles III. When the British monarch was treated for an enlarged prostate in January, doctors found a cancer that the palace said is not prostate cancer. Charles started treatment Monday. The palace did not disclose what had led to the king’s diagnosis.

While some prostate specialists like Dr. Peter Albertsen at the University of Connecticut called such situations “pretty rare,” other doctors said they were not unheard of.

Dr. Otis Brawley, an oncologist at Johns Hopkins Medical Center in Baltimore, said a man had come in for routine prostate surveillance to monitor a low-risk cancer. One of Dr. Brawley’s residents ordered a chest X-ray “for no reason,” he said. But to the surprise of Dr. Brawley, the X-ray detected a lung cancer.

Some cancers demand immediate treatment, while for others, treatment can wait, oncologists said. The palace did not describe the severity of Charles’s diagnosis, nor what treatment he was receiving.

Some blood cancers are among those that need immediate treatment, Dr. Brawley said.

“We even have a few leukemias and lymphomas where we want to start therapy less than 24 hours after suspicion,” he said. He said he doubted Charles had one of the most aggressive blood cancers, acute myeloid leukemia, nor Burkett’s lymphoma. But if he did, treatment would not be put off.