Gay rights advocates said the rules change was inspired by one of those cases involving a same-sex couple, Janice Langbehn and Lisa Pond, who were profiled in The New York Times last year. After Ms. Pond was stricken with a fatal brain aneurysm, Ms. Langbehn was denied visiting rights in 2007 by a Florida hospital. Although Ms. Langbehn had power of attorney and she and Ms. Pond were parents to four children they had adopted, the hospital refused for eight hours to allow her and the children to see Ms. Pond, her partner for 18 years. Ms. Pond died as Ms. Langbehn tried in vain to get to her side.

Ms. Langbehn, represented by Lambda Legal, a legal advocacy organization, brought suit against the hospital, Jackson Memorial in Miami, but lost. On Thursday night, Mr. Obama called her from Air Force One to say that he had been moved by her case.

“I was so humbled that he would know Lisa’s name and know our story,” Ms. Langbehn said in a telephone interview. “He apologized for how we were treated. For the last three years, that’s what I’ve been asking the hospital to do. Even now, three years later, they still refuse to apologize to the children and I for the fact that Lisa died alone.”

Mr. Obama campaigned saying he would fight for the rights of gay men and lesbians, but he has been under pressure since the beginning of his presidency to be a stronger advocate for their issues.

Many gay men and lesbians grew disenchanted with what they viewed as his foot-dragging on reversing “don’t ask, don’t tell,” the policy that bars them from serving openly in the military. The president said in his State of the Union address this year that he intended to move to overturn the policy, and his administration has been taking steps to do so.

The memorandum is intended to “help ensure that patients will be able to face difficult times in hospitals with compassion, dignity and respect,” a White House spokesman, Shin Inouye, said Thursday night. “By taking these steps, we can better protect the interests and needs of patients that are gay or lesbian, widows and widowers with no children, members of religious orders, or others for whom their loved ones are not always immediate relatives. Because all Americans should be able to have loved ones there for them in their time of need.”