What is the historic basis and/or context for "Honoris Causa" degrees? What were the original reasons for granting these?
They have quite a long history and although customs gradually changed over time, it was basically always related to the influence of powerful people (typically nobility).
One of the earliest examples was by Oxford to gain favor with an influential nobleman in the late 15th century, shortly before making him chancellor. The university continued to give them out (mostly voluntarily) for a while, but it really took off under pressure from King Charles I who, in the mid-17th century, requested hundreds of honorary degrees for his acquaintances.
The earliest honorary degree (in the sense which we would understand it today) appears to have been offered to Lionel Woodville in 1478 or 1479. Woodville, Dean of Exeter and the brother-in-law of Edward IV, appears to have already held the degree of Bachelor of Canon Law; the University offered to confer the degree of Doctor of Canon Law on him without the usual academic exercises. It was thus an offer to dispense with the usual requirements, but was apparently unsolicited and clearly an attempt to honour and obtain the favour of a man with great influence. Woodville was shortly afterwards elected Chancellor of the University, a post he held until the death of Edward IV in 1483.
When Charles I moved his court to Oxford in 1642 the University was prevailed upon by the King to award about 350 honorary degrees (in all faculties, including doctorates where applicable) between November of that year and the following February. The University responded by presenting the King with a petition arguing that the practice of conferring large numbers of honorary degrees was damaging to the University: not just to its reputation as a seat of learning, but also financially. It asked the King not to present any scholar for a degree unless he was 'capable by our Statutes, & give Caution to performe his Exercises, and pay all usual fees' (OUA NEP/supra/Reg Sb, pp21-2). The King agreed to the request.