The use of this so-called "constitution of Medina" is purely modern and has no historical usage at all. Originally, the document referred to was called a "treaty". It was not even called a charter until the 20th century. It has never been called a "constitution" by any English-speaking historian ever so far as I am aware.
The first "constitution" was the Britannic Constitution created by the Coronation Oath Act in 1689 after the Glorious Revolution. The origin of the term can be found in the first paragraph of the act:
In the wake of this deal between the English parliament and the Dutch stadtholder William, a number of English legal theorists devised a body of supposed law and "rights" which they termed the Britannic Constitution, which was essentially the creation of the idea of a "constitutional monarchy". When the American colonies of Britain revolted they devised their own articles of state which they likewise called a "Constitution" and subsequently also devised a "Bill of Rights" named after those articles which were already established by English parliamentary law and theory.
Since that time, innumerable countries have fashioned "constitutions" in imitation of that of the United States.
To call old bodies of laws like Hammurabi's Code "constitutions" would be anachronistic.