A White House official said that Mr. Schumer raised the possibility of a one- or two-day extension, but Mr. Trump told Mr. Schumer to work out the details of a short-term measure with Senator Mitch McConnell of Kentucky, the majority leader.

A short time later, Mr. Schumer called the president, the person said, but the conversation drove the pair even further apart. The immigration concessions from Democrats were not conservative enough, Mr. Trump told Mr. Schumer. The president said he needed more border security measures as well as more enforcement of illegal immigration in parts of the country far from the border.

As the evening wore on, Mr. Schumer got a call from Mr. Kelly that dashed all hopes for a Trump-Schumer deal before the shutdown deadline of midnight. Mr. Kelly, a hard-liner on immigration, the person familiar with the call said, outlined a long list of White House objections to the deal.

A White House official familiar with the call said Mr. Kelly urged Mr. Schumer to work out the details of an agreement with Mr. McConnell.

In a Twitter post at 9:28 p.m., Mr. Trump vented his pessimism on Twitter, returning to his administration’s efforts to try to make sure that Democrats receive the blame from voters angry about a government shutdown exactly one year from his inauguration.

“Not looking good for our great Military or Safety & Security on the very dangerous Southern Border,” Mr. Trump wrote. “Dems want a Shutdown in order to help diminish the great success of the Tax Cuts, and what they are doing for our booming economy.”

With talks between Mr. Trump and Mr. Schumer over, Republicans in the Senate scheduled a vote on a House-passed measure that leaders in both parties expected to fail. After the shutdown began, Mr. Schumer lamented the failure to reach a deal with the president, and blamed Mr. Trump for abandoning an agreement that was within reach.