In fact, the 2010 Affordable Care Act , also known as Obamacare , largely excluded undocumented immigrants from buying into public programs.

"That particular position may come back to haunt them in the general election," said the Indiana Democrat who also served as governor of his state. "It's nice to be able to promise some of these things, but they have got to be realistic."

Support among many of the 2020 Democratic presidential hopefuls of government health care for undocumented immigrants may prove damaging in the eventual race against President Donald Trump , former Sen. Evan Bayh told CNBC on Monday.

All ten Democratic presidential candidates raise their hands to indicate that they would provide Medicaid benefits to illegal immigrants during the second night of the first Democratic presidential candidates debate in Miami, June 27, 2019.

In the first Democrat debate last week, the 10 candidates on stage the second night on Thursday — including former Vice President Joe Biden as well as Sens. Bernie Sanders, Kamala Harris and Kirsten Gillibrand — all raised their hands when asked who would offer health insurance to immigrants who entered the U.S. illegally.

Trump quickly responded on Twitter.

All Democrats just raised their hands for giving millions of illegal aliens unlimited healthcare. How about taking care of American Citizens first!? That's the end of that race

Bayh, who took initial steps to run for president in 2008 but then decided against it, said the kinds of issues that play in a primary race might be detrimental in a general election. "The base of the party, which tends to dominate the nominating process, may not be part of the electorate that decides the general election outcome."

"I'm afraid President Trump and the people who support him ... filed that footage away," Bayh added.

Among the 10 candidates debating on the first night on Wednesday, Sens. Elizabeth Warren and Cory Booker are also on the record as supporting such health coverage for migrants.

Nearly every candidate seeking the Democratic nomination supports some kind of government health-care solution, including Medicare-for-all and universal coverage plans.