From the moment human beings began to engage in organized economic activity of some sort, there was a prevailing sense of awareness of the need to transfer risks that could not be borne by an individual economic entity to other economic entities and to diversify them.
The Code of Hammurabi, a Babylonian law code dating back to around the 18th century B.C., apparently refers to a contract under which the owner of a trading vessel who, when applying for loans for procuring cargo, paid a special fee in advance and was thus exempted from repayment of the relevant loans in the case of loss or damage of the cargo procured.