Definition of the term
As-Sa'adi defined Karamah الكرامة in his at-Tanbeehaat al-Lateefah fima Ahtawiyat ‘alayhi al-Waasitiyyah min al-Mabaahith al-Muneefah, p. 107 as follows:
The karaamah is an extraordinary event that Allah causes to occur at the hands of His believing close friends (awliya’), such as knowledge, power, and so on, and such as the shade that used to come upon Usayd ibn al-Hudayr when he recited Qur’aan, and the shining of light for ‘Abbaas ibn Bishr and Usayd ibn Hudayr when they left the Prophet (blessings and peace of Allah be upon him), and when they separated there was light for each of them at the end of his whip. (Source: islamqa #124838)
So it is simply speaking karamah refers to a God given gift which can be described as some kind of miracle or extraordinary event that may happen to a pious or righteous person who is not a prophet. It happened to many people as stated in the qur'an and quoted in the sunnah (or athar) or in books quoting biographies of such pious or righteous people.
Beside those Karamaat كرامات (plural of karamah) which were already mentioned by @UmH in the qur'an there are also:
- that of Mariam's () provision -assuming there are no female prophets (See Why were there no female Prophets?) which is mentioned in (3:37). And that of giving here the force to shake the trunk of the palm tree while she was pregnant in order to make fresh dates drop down from it which is mentioned in (19:25) and which usually can only be achieved by a group of strong men.
- Some of the mufassireen actually interpreted the verb ضحك (which often was interpreted literally as smiled) as she got her menses (back) in old age and consider this as a karamah as she actually isn't a prophet which is mentioned in (11:71-72).
Among those quoted in sunnah books one may count:
Some examples from among those quoted in biographies:
- Imam a-Dhahabi الذهبي quoted in his biography of the scholar Muhammad ibn Nasr al-Marwazi محمد بن نصر المروزي in his Siyar 'a'alaam an-Nubala' سير أعلام النبلاء (with a narrator chain) the following story which al-Marwazi narrated:
In the following I'm translating from Arabic, as these translations are mine take them carefully!
خرجت من مصر أريد مكة ومعي جاريتي , فركبت البحر فغرقت, وصرت إلى جزيرة إنا وجاريتي , فما رأينا فيها أحدا , وأخذني العطش فلم اقدر على الماء , فوضعت رأسي على فخذ جاريتي مستسلما للموت فإذا رجل قد جاءني ومعه كوز , فقال لي: هاه ؟ فشربت , وسقيتها , ثم مضي فلم أدر من أين جاء ؟ ولا من أين راح؟
(Source: Siyar *A'alaam an-Nubala' سير أعلام النبلاء)
I left Egypt towards Mecca in company of my slave girl (servant). We traveled by sea and (our ship) sank, we (my servant and me) reached an island on which we didn't notice anybody. And I got thirsty but couldn't find water. Finally I put my head on the tight of my servant expecting death, when suddenly a man came with a mug He asked (invited me): "hm?" and I drunk and gave my servant too, then he left and I didn't know neither from where he came nor where he went.
- Al-Khatib al-Baghdadi quoted in his Tareekh Baghdad تاريخ بغداد the following story of Bunan ibn al-Hassan al-Hammal from Waasit بنان أبو الحسن الحمال (with a narrator chain)
سمعت أبا علي الروذباري ، يقول : كان سبب دخولي مصر حكاية بنان ، وذاك أنه أمر ابن طيلون بالمعروف ، فأمر أن يلقى بين يدي السبع ، فجعل السبع يشمه ولا يضره ، فلما أخرج من بين يدي السبع ، قيل له : ما الذي كان في قلبك حيث شمك السبع ؟ قال : كنت أتفكر في سؤر السباع ولعابها …
(Source: Tareekh Baghdad تاريخ بغداد and Siyar a'laam an-Nubala')
I heard ar-Rudhbary saying: The reason why I entered (went to) Egypt was the story of Bunan, this is because he enjoined good to ibn Tulun who then throw him (in a cell) in front of a lion. But the lion was only sniffing him but not harming him. When he was brought out from the lion's cell.
He was asked: What did you (feel) think in your heart (1) while the lion was sniffing you?
He answered: I was thinking about the remainder of the lions food and its saliva...
(1) what was on your mind
Conditions and difference between other kinds of miracles
Note that unlike Mo'jizah المعجزة which usually is translated miracle (for prophets and messengers ()) a Karamah can still happen to any pious person as -as already mentioned- it is a kind of gift of Allah to those who are close to Him.
Based on (10:62-63):
Unquestionably, [for] the allies of Allah there will be no fear concerning them, nor will they grieve (62)
Those who believed and were fearing Allah (63)
Which defines those who may be given such a gift.
Also note that ad-Dajjal will be given similar gifts, but they are not considered as Karamaat.
Therefore there are actually conditions for this gift to be described as karamah:
the first was mentioned in the verse above: being a fearful and pious (righteous) believer.
not pretending to be one of Allah's allies (waly) as none of us knows whether Allah accepted our deeds so pretending otherwise is pretending to know the unseen while Allah says:
Say, "I hold not for myself [the power of] benefit or harm, except what Allah has willed. And if I knew the unseen, I could have acquired much wealth, and no harm would have touched me. I am not except a warner and a bringer of good tidings to a people who believe." (7:188)
and Allah only accepts from righteous people as HE says:
… "Indeed, Allah only accepts from the righteous [who fear Him]. (5:27)
and HE tells us not to claim ourselves to be pure and pious saying:
Those who avoid the major sins and immoralities, only [committing] slight ones. Indeed, your Lord is vast in forgiveness. He was most knowing of you when He produced you from the earth and when you were fetuses in the wombs of your mothers. So do not claim yourselves to be pure; He is most knowing of who fears Him. (53:32)
Scholars also added:
such a karamah shouldn't be a reason to leave out any of our duties. For example pretending we are allowed to leave out wudu' to pray as we have been given such a gift is a lie.
such a gift or karamah should be in accordance to the rulings of our religion for example it can't be that a karamah needs the consumption of alcohol.
Some of my references this article on islamway and fatwa islamqa #225045 (both in Arabic). Read also the first fatwa linked above about the differences between karamah and mu'jizah.