WASHINGTON — By pushing Prime Minister Benjamin Netanyahu of Israel into barring an official visit by the first two Muslim women in Congress, President Trump is doubling down on a strategy aimed at dividing the Democratic Party and pushing some Jewish voters into the arms of Republicans.

But people in both parties warn that over the long term, the president could further erode bipartisan support for Israel, which has long relied on the United States as its most important ally.

In the run-up to his 2020 re-election campaign, Mr. Trump has spent months attacking the two freshman Democrats, Representatives Rashida Tlaib of Michigan and Ilhan Omar of Minnesota, angering the Democratic Party as he seeks to paint Republicans as Israel’s only true friend in Washington.

He has also marched in lock step with Mr. Netanyahu, who faces legislative elections in a few weeks. Mr. Netanyahu’s hard-line settlement policies and rigid bond with ultra-Orthodox Jews have also alienated Democrats, including many American Jews, posing a threat to the bipartisanship that has been fundamental to the two countries’ relationship since Israel’s founding in 1948.

If Israel becomes a partisan issue in the United States, advocates warn that there could be negative consequences for both countries. Israel’s security would be severely undermined without the political, economic and military support that flows from bipartisan backing in Washington. And if Israel is weakened, so too is the United States’ position in the Middle East, which is always stronger when both parties are behind it.

“You have a situation where Netanyahu is relying on Trump to help him in his re-election, and Trump is expecting Netanyahu to reciprocate,” said Martin S. Indyk, a former ambassador to Israel under President Bill Clinton. Mr. Trump’s election strategy, he said, was to paint Ms. Tlaib and Ms. Omar as the “face” of a Democratic Party that is anti-Israel because the two women have been critical of the country.

In a string of Twitter posts on Friday evening, Mr. Trump said just that, writing that Ms. Tlaib and Ms. Omar “are fast becoming the face of the Democrat Party” and that Ms. Tlaib had behaved “obnoxiously” toward Israel.

The bond between Israel and the United States has long been rooted in what Aaron David Miller, a veteran Middle East negotiator for both Republican and Democratic administrations, calls “a confluence of interests and values,” such as free speech and an open society. The cancellation of the congresswomen’s trip, he said, raised questions about those shared values.

Ms. Tlaib and Ms. Omar both support the boycott Israel movement and had planned a four-day fact-finding tour that was largely centered around examining the condition of Palestinians under Israeli occupation.

Tensions deepened on Friday, when Ms. Tlaib rejected an offer by Israel to allow her to visit her grandmother, who lives on the West Bank, on humanitarian grounds, switching course after she had agreed in writing not to “promote boycotts against Israel” during her trip. Ms. Tlaib’s reversal under pressure drew criticism from Mr. Trump, who said on Twitter that she had “grandstanded.”

“There is a perception, right or wrong, true or untrue, that the Netanyahu administration and the Trump administration are working hand in glove,” said Mark Mellman, the president of Democratic Majority for Israel, a nonprofit that works to ensure that the Democratic Party remains pro-Israel.

Israel’s stance, Mr. Mellman said, has made his task harder. “In our hyperpartisan world,” he said, “the friend of my enemy is my enemy, and to the extent that Democrats look at Trump as the enemy, if they see Israel or the Netanyahu administration as operating hand in glove, that gives them real pause.”

Mr. Netanyahu made clear his affinity for the Republican Party long before Mr. Trump moved into the White House. His relations with President Barack Obama were so strained that in 2015, in a rare breach of protocol, he circumvented the White House in accepting an invitation to address the Republican-led Congress. Representative Nancy Pelosi, then the Democratic leader, called the address an “insult” to the United States, and dozens of Democrats skipped it.

With Mr. Trump in office, the Netanyahu-Republican alliance has only strengthened. Mr. Trump’s policies, including moving the American Embassy to Jerusalem and recognizing Israel’s sovereignty over the Golan Heights (where Mr. Netanyahu named a new town after Mr. Trump in June, erecting a sign with his name in gold block letters), have made him more popular in Israel than he is at home. When the president pushed Mr. Netanyahu to bar entry to Ms. Omar and Ms. Tlaib, he was effectively calling in a favor.

Even the American Israel Public Affairs Committee, the powerful and assiduously bipartisan pro-Israel lobbying group known as AIPAC, has split with the Netanyahu government on its decision. AIPAC typically backs Israel no matter who is in power, but its view is that while presidents and prime ministers come and go, support for Israel in Congress is essential.

“What is the one mantra of the pro-Israel organizations for 30, 40 years?” asked William Kristol, a conservative critic of Mr. Trump who fought Mr. Obama’s policies toward Israel. “It’s congressional support. Presidents have their own views, but Congress is the core. So to pick a fight with members of Congress, which is going to force half of Congress to rally to their defense, is really foolish.”

While support for Israel among congressional Democrats remains strong, polls show that support has long been slipping among Democratic voters. A survey last year by the Pew Research Center found the partisan divide in support for Israel was at its widest in four decades, with 79 percent of Republicans sympathizing with Israel in its dispute with the Palestinians, versus 27 percent of Democrats.

That is evident on the presidential campaign trail, where Democrats once vied to see who could be the most supportive of Israel. Now, some are vying to see who can be the most critical. Beto O’Rourke, the former Texas congressman, recently called Mr. Netanyahu a “racist.” Senator Bernie Sanders of Vermont accused the Netanyahu government of “racism” and proposed using American aid to Israel as leverage to change its policies.

Matt Brooks, the executive director of the Republican Jewish Coalition, which aims to woo Jews to the Republican Party, said it was wrong to lay the dwindling Democratic support at the feet of Mr. Trump and Mr. Netanyahu.

“When you have a leading Democratic presidential candidate like Bernie Sanders who can call the prime minister of Israel a racist and nobody says anything, you tell me who’s responsible for it,” Mr. Brooks said. “We have a president who is the most pro-Israel president ever in history.”

Traveling to Israel is a rite of passage for members of Congress, especially freshmen. Representative Kevin McCarthy, the Republican leader, and Representative Steny H. Hoyer, the Democratic leader, held a joint news conference in Jerusalem on Sunday, along with dozens of members, in a show of bipartisan support.

“We understand the importance of this relationship,” Mr. McCarthy said then. “We understand undeniably the bond that has to be maintained, and you have that support in the House.”

Both men urged then that Ms. Tlaib and Ms. Omar be allowed to visit. When Israel refused, citing what officials viewed as the congresswomen’s one-sided itinerary, Mr. McCarthy issued a careful statement on Twitter saying they should have come with their colleagues, and that it was “unfortunate that a few freshmen members declined to join this opportunity to hear from all sides.”

As Mr. Trump and his fellow Republicans have sought to portray themselves as the only party for American Jews, Democrats in Congress have gone to great lengths this year to show their support for the Jewish state and to isolate Ms. Tlaib and Ms. Omar.

Last month, the House overwhelmingly passed a resolution condemning the Boycott, Divestment and Sanctions movement against Israel, known as B.D.S. After Ms. Omar criticized AIPAC in remarks that were widely construed as anti-Semitic, Democratic leaders called on her to apologize — she did — and the House later passed a resolution condemning hatred of any kind.

But the Israeli government’s decision to bar the two women has strong supporters of Israel like Representative Josh Gottheimer, Democrat of New Jersey and no fan of Ms. Tlaib and Ms. Omar, taking issue with the Jewish state. Mr. Gottheimer, a centrist, called Israel’s decision “a serious, strategic mistake.”

Mr. Trump and Mr. Netanyahu have also helped turn Ms. Tlaib and Ms. Omar into victims in the eyes of the liberal left. That has energized the progressive wing of the Democratic Party, which is already deeply critical of the Netanyahu administration, and thrust Israel policy into the center of the 2020 electoral debate.

“Trump and Netanyahu are enabling one another to make Republicans the go-to party on Israel and Democrats the devil, eroding the bipartisanship that is so critical to the U.S.-Israel special bond,” said Mr. Miller, the former Middle East negotiator. “It is not yet fatal. But a few more years of the Trump-Netanyahu experience and it may well be.”