Etymology
In modern English, the terms 'hospitality' and 'hospitalisation' have come to mean two entirely different things. If you go into hospital, you are probably not looking for 'hospitality', but, etymologically speaking, hospitality is exactly what you should expect in a hospital. You might expect hospitality from 'mine host' in a hostelry, or even hostel. You would probably expect it in a hotel, but then 'hotel' or more exactly 'hôtel' is simply the modern French form of 'hostel'. The word 'hospice' too has acquired a specialist meaning though, should you find yourself in one, you may hope you will be treated hospitably.
All these words are etymologically linked as they all ultimately derive from the same root, the Latin word hospes. In medieval times, there was no distinction between a hostel, a hospice, and a hospital: the same word was used for all.
Originally, the word used for this place was the Greek xenodochium, or more correctly xenodocheion, from xenos, a stranger or guest, and docheion, a receptacle or place of reception, so a place where strangers/guests were received. This stems, of course, from the Christian duty of providing shelter to both travellers, especially the poor, and the sick. As western Christianity moved away from the Greek world and into the Roman/Latin world, the word 'xenos' was replaced by its Latin equivalent 'hospes' or 'hospite', which became 'hoste' in French. This became 'Gast' in German and 'guest' in English. In English, 'host' came to mean the person responsible for the shelter, but originally it referred to the guests. (In modern French, 'hôte' can mean either 'host' - mon hôte - or 'guest' - mes hôtes.)
The term 'xenodochium' gave way to words derived from 'hospite': the monastic hospitium or, more generally, the hospitalis domus, place for guests, shortened to hospitale. Medieval French turned 'hospitium' into 'hospice', and also, with its tendency to swallow median consonants, turned 'hospital' into 'hostel'. The person who looked after such a place was a 'hosteller' (which in English became 'ostler') or 'hospitaller', whence Knights Hospitaller.
Duties
So what did these institutions actually do? As stated above, they were based on the duty to support travellers and the sick. The scriptural reference, Matthew 25:35ff, is in Latin 'Hospes fui, et suscepistis me', which the King James Version translates as 'I was a stranger, and ye took me in'. For: 'Inasmuch as ye have done it unto one of the least of these my brethren, ye have done it unto me.' (The Latin 'quod uni ex minimus meis fecistis, mihi fecistis' is much snappier.) Matthew specifically mentions hunger, thirst, clothing and sickness, and hospitals also had the duty of burying the dead (the addition of the Christian duty of visiting prisoners completed the so-called 'seven corporal works of mercy').
Under the Benedictine rule, this duty of care was explicitly stated, but it wasn't just the monasteries who had this duty. Bishops and priests also did, and the various institutions of the Church all founded hospitals to carry out these duties. So did ordinary Christians, and wealthy citizens also endowed hospitals, sometimes in lieu of making a pilgrimage. Some hospitals were well endowed, others poorly so. Some were granted special sources of income, such as the right to charge tolls on roads or bridges (though, generally speaking, pilgrims were supposed to be exempt from tolls). Whoever their founders, these were charitable institutions and their remit was the same: tending to poor travellers and the sick. One of the formularies, probably from around 700, in the Liber Diurnus Romanorum Pontificum, a collection of standard forms for drawing up documents, lists the duties: ensure beds are ready for travellers, that doctors are on call for the sick, that food and fuel are available when needed, and so on (sadly, I've not been able to find a copy of this document online). A monastic hospitium was often one or more rooms within the monastery, but purpose-built hospitals were separate buildings.
Some of these institutions were specialised in providing for the sick, and so were more like what we would call 'hospital'. One obvious example was the numerous leper houses, which were certainly not of interest to travellers, no matter how poor. Similarly, others were intended more for travellers rather than the sick, though of course some travellers were also sick or injured. An example here was the Knights Hospitaller who were founded to provide care and assistance to pilgrims to Jerusalem. Some of this care was medical, but these 'hospitals' were not primarily medical. It wasn't until much later that 'hospital' was limited to the medical meaning it has today.
Some of the 'poor travellers' were those rendered homeless or destitute by war, what nowadays we might refer to as refugees. Quite a few of the hospitals in France, for example, were founded to cater for those who suffered from the ravages of the Hundred Years War, such as the famous Hôtel-Dieu in Beaune.
With the recent infatuation with pilgrimage to Santiago, there has been much talk of 'pilgrim hostels'; some people seem to think that pilgrims were the only travellers in medieval Europe, and they were all headed for Santiago. This is however a completely false idea. Near shrines and in other places where there were large numbers of pilgrims, accommodation was made specifically for them; the Hostal founded by the Reyes Catolicos in Santiago is an obvious example. But in most cases hospitals/hostels were intended for all travellers, not just pilgrims. This general purpose is often explicitly stated in their charter, though some of these do mention specific shrines. The emphasis was, though, on the poor, as on much-travelled roads commercial inns - the medieval equivalent of the modern hotel - sprang up for those who could afford it, just as they do today. In monasteries too, the abbot/prior would often have a separate guest-house for important guests who did not want to have to muck in with the riff-raff in the hospitium.
Some hospitals specialised in other ways. In England, several catered specifically for children and so became schools, such as Christ's Hospital in Sussex, which still maintains its original charitable status, funded by endowments. Many people today probably think of an entirely different institution when they see the word 'hospital', and I doubt whether the pupils think of themselves as being 'hospitalised', but this is just one more example of how words change their meaning over the centuries.