WASHINGTON — The Senate voted late on Thursday to prohibit the government from imprisoning American citizens and green card holders apprehended in the United States in indefinite detention without trial.