Just Me's answer covered the ruling pretty well, so I'll focus on the specifics of a grand jury.
A grand jury proceeding is nothing like a jury trial. It is an investigative tool for the prosecution that is used to get authorization to collect documents and evidence, or to recommend that formal charges be brought. Supposedly, since it is a panel of regular citizens, it is also supposed to be a check against unwarranted accusations, but the system is strongly and almost exclusively tilted in the direction of the prosecutors.
Apparently only the USA and Liberia use these systems, with other nations allowing judges to oversee these functions in preliminary hearings, instead.
The United States and Liberia are the only countries that retain grand juries, though other common law jurisdictions formerly employed them, and most others now employ a different procedure that does not involve a jury: a preliminary hearing. Grand juries perform both accusatory and investigatory functions. The investigatory functions of grand juries include obtaining and reviewing documents and other evidence, and hearing sworn testimonies of witnesses who appear before it; the accusatory function determines whether there is probable cause to believe that one or more persons committed a particular offense within the venue of a district court.
Wikipedia: Grand Jury
Why the required secrecy? It's because it's a completely "ex parte" prosecutorial process. The subject of a grand jury investigation does not even need to be informed that they are being investigated. If they do know about it, they have no right to attend (unless asked), no right to cross-examine witnesses, no right to offer testimony or rebuttal witnesses, no right to offer evidence, no right to challenge evidence. And this is accepted because the person is not yet formally accused of anything - the grand jury is investigating and trying to determine whether a prosecutor has enough to attempt a trial.
As such, evidence obtained and offered is completely one-sided. It is so one-sided that it's considered fairly easy for the state to get charges if they want them.
"The district attorney could get the grand jury to indict a ham sandwich if he wanted to," one Rochester defense lawyer said.
Rochester Democrat and Chronicle, September 2, 1979
It might get completely discredited or not even allowed into a formal trial where the defendant has rights. If these accusations, allegation or claims were allowed to be made public by the state, without any rights of the accused to offer a defense, it could both taint a potential trial, and it could destroy a life based on one-sided innuendo and false accusations. The ability to do so would also tilt the balance of power towards the prosecution, who could bully or force concessions from people just by the threat of publicity of questionable credibility.
“A lie will gallop halfway round the world before the truth has time to pull its breeches on.”
Cordell Hull (there are many variations of this quote dating back to the mid- to early-1800s)
In many states, unless specifically ordered not to (and this does vary), subjects of probes or witnesses are often free to tell about what they said or did. It's usually the state that is bound by secrecy requirements, for the reasons I mentioned above.
In this case, you have Trump and his team involved. They specifically don't want this information getting out. You probably have people who have non-disclosure agreements with Trump, which are not valid when responding to a court action, but that would mean they could testify in front of a grand jury, and later in open court, but they themselves wouldn't, potentially, be able to offer up what they had to say to a grand jury. There might not be any parties who would be free to talk who actually are interested in doing so.
"I assume a tax firm somwhere in NY has a copy of Trump's financial records and Trump won't willingly hand them over.... With subpoena in hand, can't NY prosecutors lean on this accounting firm to hand over whatever documents they have?"
That's a distinction without a difference, and I think that might actually be what is at issue here. A prosecutor might not trust a criminal target to give authentic documents, so they're going to demand them from a third party.
However, I said it's a distinction without a difference for this reason - the accounting firm may have copies of the records, but they are still Trump's personal financial records and documents. A bank or accounting firm might be the service-provider, but they are custodians, not owners, and those are still Trump's information, and there are stringent privacy regulations. The accounting firm or the bank, unless they are accused, themselves, of malfeasance, are agents for the customer, and don't have the right to divulge that information without the customer approval, unless a court orders that the information has to be offered.
The terms of Internal Revenue Code Section 6103 prohibit the IRS and your tax professional from disclosing your tax information to anyone without your explicit consent. Your tax professional can't even release your information to the IRS unless you give her your permission, and the IRS and its employees can't release any information to your tax professional unless you give the IRS permission.....
.... Some Exceptions to the Rule
The IRS lists five circumstances under which your tax information can legally and ethically be shared with certain others.
The IRS can disclose your information to your state's taxing authorities, but the state must make its request in writing.
Your tax information can be provided to law enforcement, but only if law enforcement has a valid court order for accessing it.
IRC Section 6103(k)(6) is a bit vaguer. It "allows the IRS to make limited disclosures of return information in the course of official tax administration investigations to third parties if necessary to obtain information that is not otherwise reasonably available." "Tax administration investigations" translates to audits and similar probes. If you or another party are being audited, and if your tax record provides vital, necessary information to that investigation, the IRS can share only that information.
The IRS can share your tax information with the Social Security Administration, but only to establish your liability for FICA taxes. It can't divulge any other data or information. SSA employees are bound by the same code of ethics as the IRS, and this exception doesn't extend to state Social Security administrators. It's only valid at the federal level.
Your information can be shared if you authorize it using Form 8821 or Form 2848.
The Balance - Tax Information Is Confidential: How To Protect Yours
Now, that cited article is specific to tax information, but since all of Trump's financial records are the foundation for his tax filings, I am fairly confident it's all considered to be tax records.
So..... the courts DID rule that the information has to be offered, but they are still in the grand jury portion of the process, so those records are shielded by the secrecy protections. If those documents are relevant evidence, in an actual trial, they will be offered as evidence and would then eventually become part of the public record, because trials are public proceedings, and the evidence would also be part of the public record.
So, it's not that the state of NY has to wait for at least five months to get the records, it's that there won't be any kind of public proceeding where the documents can be revealed to the rest of us for at least that long, if ever.
The grand jury is still in the middle of doing what it does. It had to stop and wait for a ruling on access to these documents. Grand juries can take weeks or months to grind through their business. Once charges are filed, just about any court is going to rule that an actual trial will have to wait until the President is not serving the nation, which takes priority. Even if they didn't, and Trump was charged, it's often many months or even years before one gets to the actual trial, especially if the defendant has the means to hire a law firm with a lot of resources to put towards the defense. That's simply how the process unfolds.
Here are a few admittedly speculative scenarios -
The records show nothing illegal, but that Trump's many claims of financial prowess are bluster and salesmanship, and that's what he wanted to keep secret. Since his re-election campaign will be concluded by time this might come out, maybe he won't care. If he's President, still, it will be "oh well, so what? I have important business to do," and it has no substantive impact on anything.
The records are evidence of criminal behavior, in which case, if he's President or not, he definitely won't want it to come out.
The records don't show anything illegal, but are potentially embarrassing, and the president, notoriously brand- and image-conscious doesn't want it to come out, especially if he's out of office, since presidents are most able to cash in on their former status of president immediately after their terms are up.
If either #2 or #3 are the case, the President will still fight to have those records disallowed, or somehow sealed, maybe even by declaring them to be "classified," though a President Biden could just as easily de-classify them. A more likely scenario, depending on the strength of the case, might be for Trump to cut a deal to something that is, relatively, a slap on the wrist, but where those documents would never get to be introduced as evidence in a public trial, because there would be no actual trial with a plea deal.
So it's entirely possible we will not see them at all for most of his remaining lifetime. If that was the goal of Trump's legal team, then they accomplished it, in all likelihood.