Hamas agreed to release the Israeli soldier Edan Alexander, who holds American citizenship, as well as the remains of four others with dual nationality, according to a statement by the group.