Karl Marx and Friedrich Engels both to some level expressed anti-homosexual sentiments in their public and private writings.
In their private communications to each other, they mocked the writings of Karl Heinrich Ulrichs and, after he was charged with homosexuality, the sexuality of Jean Baptista von Schweitzer.
Yet, they said very little on the subject in their published works.
The Communist Manifesto does not address the issue of sexual orientation or gender identity. Some anti-homosexual notions are apparent in Das Kapital.
Engels seems to be condemning homosexuality among men of ancient Greece in two separate passages in The Origin of the Family, Private Property, and the State, describing it as "morally deteriorated", "abominable", "loathsome" and "degrading".