NYT addresses this directly in an article titled "Is It Illegal to Publish a President’s Tax Returns?"
The article is in response to NBC's recent publication of another portion of the President's tax returns, with the reporter claiming he received them unsolicited in his mailbox, and broke no laws in obtaining them.
If it was a government employee who sent the documents and they were sent without authorization, that person may have broken the law. However, the NYT article says the law cited in this answer below the horizontal line "is almost certainly unconstitutional." They cite Bartnicki v. Vopper (US Supreme Court 2001):
the Supreme Court has said that journalists are free to publish truthful information on matters of public concern notwithstanding laws to the contrary as long as they did nothing illegal in obtaining the information.
See specifically 26 U.S. Code §7213(a)(3) - Unauthorized disclosure of information
(emphasis and link added):
It shall be unlawful for any person to whom any return or return information (as defined in section 6103(b)) is disclosed in a manner unauthorized by this title thereafter willfully to print or publish in any manner not provided by law any such return or return information. Any violation of this paragraph shall be a felony punishable by a fine in any amount not exceeding $5,000, or imprisonment of not more than 5 years, or both, together with the costs of prosecution.
Earlier answer based on legal citation without "almost certainly unconstitutional" article and Supreme Court citation:
It seems pretty clear that the Times "willfully" published the story, only several days after the executive editor publicly said he'd be willing to risk jail time to do so.
Yesterday, Robert Barnes published a blog post giving a "yes" answer to this question, and NPR published a piece suggesting that the likelihood of practical prosecution is extremely small, especially because Trump wouldn't want to have to answer potentially sensitive questions about his finances in any public venue under oath.
It probably comes down to how the documents were obtained, and the level of truth behind Trump's assertion that they were illegally obtained (e.g. if someone broke into an office and stole them from a locked filing cabinet, that would indicate laws were broken). The Times claims it obtained the documents just by opening mail that was properly addressed and delivered to it, and if pressed in court would probably claim the mail was unsolicited. Opponents would argue it was at least generally solicited.
Also of interest is subsection (4) of the same law quoted above:
It shall be unlawful for any person willfully to offer any item of material value in exchange for any return or return information (as defined in section 6103(b)) and to receive as a result of such solicitation any such return or return information. Any violation of this paragraph shall be a felony punishable by a fine in any amount not exceeding $5,000, or imprisonment of not more than 5 years, or both, together with the costs of prosecution.
Thus, if someone like Secretary Clinton or Reince Priebus were to successfully offer Trump (or anyone else with access to Trump's returns) any "item of material value" in exchange for his tax returns, they might be in violation of this section.
The constitutionality of restricting the press from publishing documents of public importance such as these is a different question. It may be that Times lawyers are banking on either a lack of prosecution or a first amendment defense, and/or are willing to accept the consequences in order to promote their preferred candidate and diminish the probability of electing a man they strongly feel should not be President, and/or are taking a page from Trump's own controversy-courting playbook to boost sales and pageviews. The boost they gained from this story was probably more than enough to cover a $5K+ fine. Finally, the negativity is so high in this election that there are probably folks on both sides who would rather be in jail while their preferred candidate occupies the White House than free under the main opponent's administration.