A twelve person jury is not required in all courts or countries. In fact, the use of twelve jurors is typically used in criminal cases in the United States. (Scotland uses fifteen jurors in criminal cases.) In civil cases, typically the number of jurors used is eight.
The first juries were used in Germanic tribes for the purpose of defining the character of the person on trial. Modern juries are fashioned after the English jury during the reign of Henry II (12th century). These men were required to take part in the trials under oath.
The first law which defined the use of a jury was signed into effect in 1166. It was called the Assize of Clarendon.
As for the numbers of juries, juries are only required to be compromised of a cross-section of the public. (In 1970, the Florida Supreme Court ruled that a twelve person jury was not necessary. In 2001, the Australian High Court also decided that a jury of twelve was not necessary. In 2009, Scotland's courts re-examined their 15 person jury and found it to be "uniquely right."
According to a study completed by the University of Glasgow, many prefer a jury number of seven based upon the fact that people were more comfortable speaking to a smaller group and a unanimous decision could be reached more easily.
You can read the other criminal jury cases here also, but Williams v. Florida, at page 87, et. seq. states Lord Cokes traditional # comes from the #12, the 12 Apostles, 12 Stones, 12 Tribes.
The Rules of Criminal procedure in my state, Ohio, demand a 12 member jury for both misdemeanors and felonies, and the verdict must be unanimous.
As a side note, when a jury is deadlocked, a Judge, in many states, can instruct them to reconsider thier vote, this is known federally as an Allen Charge, from the US SC case of the same name, 1890's?
Some states may refer to them as another name under thier case law. I do not know if my state permits such a charge, as I did not look it up, but I do know from past research New York does not permit it under thier Constitution, so there a deadlocked jury is dismissed.