does it make sense to speak of infringement if no patent existed when
I published the software?
Not really. The right to enforce the patent arises only starting when it is granted.
If yes, how much time do I have to unpublish my software before I can
be sued for infringement (I mean, I can discover a bit later that a
patent was filed!)
While there is no good faith or ignorance excuse to direct patent infringement, which can be committed innocently, a patent owner is require to mark a product invention with notice of the patent or give actual notice to an infringer to recover money damages from the infringer (subject to some complicated rules that apply when an infringer is copying another knowing infringer without knowing that the person they are copying is infringing, for example if the author's publication was actually an unacknowledged infringement of someone else's pre-existing patent of the same idea).
So, usually, the opening salvo of a patent infringement case is a cease and desist letter, threatening to bring an action for injunctive relief and to collect money damages for infringements taking place after the cease and desist letter is received.
If you had no prior notice that the patent had been issued, and you cease to use or sell the directly infringing invention once you receive a cease and desist letter from the patent holder or other actual notice of the existence of the patent, while you have technically engaged in direct infringement, there is no meaningful penalty that will flow from that conduct.
As long as you take no affirmative acts to infringe the patent once you learn that it has been issued, you should be good. Actions you took before the patent was issued were, by definition, not infringing.
The inventor's communication to you would be powerful evidence that you not only did not have actual knowledge, but that any potential to get actual knowledge was actively concealed from you, which would probably make the case against awarding money damages against you prior to you obtaining actual knowledge of the patent a strong one.
In addition to direct infringement, indirect or contributory patent infringements also exist.
Contributory patent infringement is selling something non-infringing that is specially made knowing that it will be used in order to commit direct patent infringement. Since this has a knowledge element, one cannot be an innocent contributory patent infringer.
Indirect infringement is basically the patent law equivalent to conspiracy or solicitation in criminal law, when the indirect infringer solicits an infringement by a direct infringer or conspires with a direct infringer, and carried joint and several liability for the direct infringement (whether or not the direct infringer itself is sued). But, if no one involved knows of the patent's existence and ceases to use it immediately upon being told, again, there are no meaningful consequences for the indirect infringement, even though technical indirect infringement occurred.
As noted in another answer, the U.S. patent would have to be applied for within a year of the publication or the public disclosure would make the idea not patentable. The public disclosure would also prevent all patent liability in other countries.
Also, the statement that was made to you sometime after the publication, would only have to be honored for less than a year after it was made to be effective at protecting anyone from a patent being issued.
The statement made to you may also estop the authors of the software from claiming money damages from you at least until you learn that they changed their minds and patented the idea.
If the idea had already been patented by someone else, and was then enforced without notice to you since the initial infringer had notice of the patent, you might even have a claim for fraud against the author who told you that it wouldn't be patented (concealing his knowledge of the patent) for your damages until you could take action to mitigate them (e.g. in the case where they stole the idea and you were directly infringing without notice for that reason in the period before you received a cease and desist notice or legal complaint for patent infringement).
So long as you observe the limitations of the MIT license, you should feel comfortable that you are not likely to be exposed to meaningful patent lawsuit liability from the group of researchers you contacted without notice.