Last month, more than 100 members of Congress sent a letter to Secretary of State John Kerry, urging the State Department to deny visas to the spouses of diplomats from countries where the same-sex spouses of American Foreign Service officers are unwelcome. The department responded that it was unable to do that for legal reasons.

Instead, the State Department says that the work involved in resolving the visa issue is being done quietly, by necessity.

Officials there also say that progress has been made: In 2011, according to department statistics, only 38 percent of the postings around the world could guarantee visas for same-sex spouses. And this year, the department appointed Randy W. Berry, a longtime diplomat, as a special envoy for the rights of gay, bisexual and transgender people.

Most countries in Africa, Asia, the Caribbean and the Middle East deny same-sex spouses diplomatic visas. In many cases, spouses are permitted to enter the country, but the visas do not allow them to work and most often require them to leave every few months to reapply. The spouses also do not have the protections that come with diplomatic visas.

The local political climate can make not carrying a diplomatic visa problematic. In December 2013, in the middle of a confrontation between India and the United States over the arrest of an Indian deputy consul general in New York for her treatment of a housekeeper, the Indian Supreme Court reinstated an anti-sodomy law. After the court’s ruling, a prominent Indian politician suggested that the government arrest the same-sex companions of American diplomats.

“Put them behind bars, prosecute them in this country and punish them,” said the politician, Yashwant Sinha.

Even as support for same-sex marriage grows in the United States, some countries have been pushing back against gay rights. Macedonia approved a constitutional amendment this year defining marriage as a union between a man and a woman. In 2014, the Nigerian president signed a ban on same-sex relationships that threatens violators with 14-year prison terms. Same-sex relationships are still legal in Russia, but a 2013 law banning gay “propaganda” was widely interpreted as a vehicle to suppress gays in the country.