WASHINGTON — In his State of the Union address, President Trump announced a bold plan to end the scourge of H.I.V. by 2030, a promise that seemed to fly in the face of two years of policies and proposals that go in the opposite direction and could undermine progress against the virus that causes AIDS.

In November, the Trump administration proposed a rule change that would make it more difficult for Medicare beneficiaries to get the medicines that treat H.I.V. infection and prevent the virus from spreading.

Mr. Trump has repeatedly urged Congress to repeal the expansion of Medicaid under the Affordable Care Act, even though Medicaid is the largest source of coverage for people with H.I.V. And he has promoted the sale of short-term health plans that skirt the Affordable Care Act, even though such plans usually exclude people with H.I.V.

To end the spread of the virus, federal health officials say they must reduce the stigma attached to gay men and transgender people who are at high risk so they will seek testing and treatment. But for two years the administration has tried to roll back legal protections for people in those groups.