A federal judge in New York on Monday ruled President Trump’s accounting firm must turn over eight years of his personal and business tax returns, an order that was immediately put on hold by an appeals court.

The decision came in a lawsuit filed by Mr. Trump against Manhattan District Attorney Cyrus Vance Jr. and Mazars USA LLP, his longtime accounting firm. Mr. Trump sought to block a subpoena for his tax returns that state prosecutors sent to the accounting firm, saying it was unconstitutional to subject a sitting president to what he called the “criminal process.”

Mr. Trump’s lawyers filed an emergency appeal minutes after the ruling, leading a judge from the Second U.S. Circuit Court of Appeals to put the ruling temporarily on hold “because of the unique issues raised by this appeal.” The appeals court said the hold on enforcement of the subpoena would remain in effect until it hears arguments in the case, which are expected as early as the week of Oct. 21.

A Justice Department lawyer on Monday asked the appeals court to give the department sufficient time to weigh in, saying the issues involved were novel and raised weighty constitutional concerns.

Mr. Vance’s office sent the subpoena to Mazars in August as part of its probe into whether hush-money payments by a former Trump lawyer to adult-film actress Stormy Daniels, and how these payments were recorded, violated a state law against falsifying business records.