When speaking about irony, it is important to note that there are in fact three different kinds of irony: situational irony, verbal irony, and dramatic irony. The line that closes "The Story of an Hour" is an example of dramatic irony.
Dramatic irony exists when readers have information which the characters within the story are not privy to. In this case, readers would have been aware of Mrs. Mallard's epiphany and feelings of liberation after learning of her husband's supposed death. Thus, the discovery of her husband still being alive was, for Mrs. Mallard, quite the opposite of joyous. The fact only Chopin's readers would be aware of these details is what makes this an example of dramatic irony.
At the same time, Chopin's decision to give this line to the doctors may have likely been closely connected with the social criticisms she raises in this story regarding gender. Ultimately, "The Story of an Hour" concerns the problem of inequality, particularly as seen within the institution of matrimony, and the degree to which women existed under the domination of the men in their lives. This was Louise Mallard's epiphany: that with her husband having died, for the first time in her life, she could experience genuine liberation, with her own existence no longer being an extension of her husband's.
With this thematic context in place, consider the state of nineteenth-century medicine: the medical profession has traditionally (and especially within this time period) been viewed as a primarily masculine field. Here we have men, in a field monopolized by men, wielding the authority of a medical education which only men would have been permitted to pursue. In this sense, with the arrival of the doctors, (here again) we see this same erasure of agency. The doctors, in their professional expertise, have their own assumptions about Louise's psychological state, and they impose that narrative accordingly, even as those assumptions could not be further from the truth. In life, Louise's existence was subjugated to her husband. In death, it has been subjugated to the doctors, who dictate how her last moments will be remembered and explained.