Previously, juries had been both accusers and witnesses. At first, it made sense to use people who knew something about the offence also to sit at trial. Later, the need to have unbiased jurors became clear. It is hard to say. Throughout history the number 12 keeps reappearing.
People often consider it a holy number.
For instance, there were 12 tribes of Israel, Solomon had 12 officers and Jesus had 12 disciples. However, other variations are possible. Greek juries were huge - there were 501 jurors at the trial of Socrates. Only six people sit on the criminal juries in the Territories. Most people today think jury trials are a great thing.