The president sought to end a program that allowed migrants fleeing Cuba, Nicaragua, Venezuela and Haiti to fly into the United States and remain in the country for up to two years.