Voters in South Dakota and North Dakota have rejected a ballot measure meant to legalize recreational marijuana.