Ketuba means, "that which is written", i.e., a document. The Ketuba is not a contract between the husband and his wife, rather, the Ketuba is a document which stipulates the obligations of the husband toward his wife, and mainly the terms and compensation that the husband will grant to his wife in the event that the marriage is, chas veshalom, dissolved.
The Ketuba, writes Aryeh Kaplan (Made in Heaven, p. 95) "is closely related to the mohar- dowry- mentioned in the Bible. (Exodus 22:5). The mohar was the amount that a man would agree to pay his bride in the event that the marriage was terminated".
Most Rabbinic authorities, including Maimonides (Ishut 10:7), wrote that the Ketuba is not mandated by the Tora but was formalized by the Rabbis. Although they might have been a custom of giving a Ketuba even before the Tora was given, this custom was never formulated into Law. Originally a man could simply put aside an amount of money and that would be his wife's mohar. The Ketuba, the formal obligation that establishes the sum of money owed to the wife in case of divorce, was established around the year 100 BCE by the Sanhedrin under the leadership of rabbi Shimon ben Shatach, who legislated that a man's entire estate would be mortgaged to the Ketuba. The woman, thus, would be able to collect the Ketuba just as she would any other contracted debt. Accordingly, and since then, the Rabbis prescribed that it is forbidden for a man to live with his wife unless a Ketuba has been executed and signed.
Maimonides (ibid.) writes that the Rabbis' establishment of the Ketuba contemplated another important factor: the Ketuba, the future financial obligations of the husband toward his ex-wife, would serve as a deterrent to prevent an impetuous divorce.