According to Islamic law, are there any cases in which imprisonment is prescribed as a punishment? And what alternatives exist?
I am familiar with a few such as flogging, stoning and limb amputation but I have not come across imprisonment!
The concept of Imprisonment does exist in Islamic law. It has been ordered in various Quranic verses such as:
فأمسكوهن في البيوت حتى يتوفاهن الموت أو يجعل الله لهن سبيلا
confine them to their houses until death takes them or Allah ordains for them [another] way.
تحبسونهما من بعد الصلاة
detain them after the prayer
و ينفوا من الأرض
or they should be imprisoned [lit. 'kept away from (all) the land']
And it is proven in the Sunnah of the Prophet ﷺ :
عن النبي صلى الله عليه وسلم قال: إذا أمسك الرجل الرجل وقتله الآخر يقتل الذي قتل ويحبس الذي أمسك
The Prophet ﷺ as saying, “If a man seizes a man and another kills him, the one who killed him is to be killed and the one who seized him is to be imprisoned.”
أن النبي صلى الله عليه وسلم حبس رجلا في تهمة
The Prophet (ﷺ) imprisoned a man on suspicion.
And there are reports that the caliphs and the judges imprisoned people for various crimes, and none of the other sahaba and tabi'een criticized them for it, establishing Ijma' on the matter.
Imprisonment is part of the standard punishment for the following crimes:
Apostasy. An apostate is imprisoned for a period of time before execution, to allow him the chance repent and return to Islam. This imprisonment prior to execution is obligatory according to the Malikis, Shafi'is and Hanbalis and is recommended according to the Hanafis. Also according to the Hanafis, a female apostate can not be executed but remains imprisoned indefinitely unless she reverts.
فقال عمر أفلا حبستموه ثلاثا وأطعمتموه كل يوم رغيفا واستتبتموه لعله يتوب ويراجع أمر الله
Umar said (regarding an executed apostate), 'Didn't you imprison him for three days and feed him a loaf of bread every day and call on him to tawba that he might turn in tawba and return to the command of Allah?'
عن ابن عباس، قال: لا تقتل النساء إذا ارتددن عن الإسلام، ولكن يحبسن ويدعين إلى الإسلام ويجبرن عليه
Ibn Abbas said: Do not kill women who abandon Islam, rather imprison them and call them to Islam and force them.
Abandoning Salah. Such a person is initially imprisoned according to the Malikis, Shafi'is and Hanbalis but is later executed if he continues to refrain from salah. According to the Hanafis he is not executed but remains imprisoned. See Some scholars say Muslims who don't pray are not unbelievers, but are executed: on what grounds is this justified? for more details.
وخذوهم واحصروهم واقعدوا لهم كل مرصد فإن تابوا وأقاموا الصلاة وآتوا الزكاة فخلوا سبيلهم
And capture them and besiege them and sit in wait for them at every place of ambush. But if they should repent, establish prayer, and give zakah, let them [go] on their way.
Highway robbery. According to the Hanafis a robber who has only terrorized people but not taken life nor seized wealth - is to be punished by imprisonment, as they interpret ينفوا in verse 5:33 as meaning imprisonment. The Shafi'is also allow for imprisonment as an interpretation or a substitute for exile in this case (see Mughni al-Muhtaaj: بحبس وغيره). And the Malikis say that the culprit should be imprisoned in the land to which he has been exiled.
إنما جزاء الذين يحاربون الله ورسوله ويسعون في الأرض فسادا ... أو ينفوا من الأرض
Indeed, the penalty for those who wage war against Allah and His Messenger and strive upon earth [to cause] corruption is ... or that they be exiled from the land.
نفيه حبسه ... واختلف في النفي, فقال أصحابنا: هو حبسه حيث يرى الإمام ... وقال مالك: ينفى إلى بلد آخر غير البلد الذي يستحق فيه العقوبة فيحبس هناك
Exile means imprisonment ... and the scholars differed on 'exile' and our companions said that it means imprisonment at whatever place the ruler wishes ... and Imam Malik said that the person will be exiled to a different city and then will be imprisoned there.
Fornication. For a virgin the punishment of Zina includes flogging a hundred lashes and exile for a year. And according to the Malikis the person is to be imprisoned in the place to where he is exiled. According to the Hanafis exile is a Ta'zir and can be substituted with imprisonment.
وقال مالك : ... ومن نفي حبس في الموضع الذي ينفى إليه
Malik said: ... the one who is exiled (for Zina) will be imprisoned at the place to which he is exiled.
Imprisonment is also a possible Ta'zir punishment. A Ta'zir can be enforced as a penalty for any sin which does not have a prescribed penalty in the Quran and Sunnah. Some of the matters on which the jurists have specified punishment by imprisonment include the following (not an exhaustive list):
Repeated theft. If a person steals again after the Hadd of amputation has already been given to him, then he is to be imprisoned. According to the Hanafis and Hanbalis this is done on the third offense, and according to the Malikis and Shafi'is on the fifth offense.
More generally: For any person who persists in committing a sinful act. And for any miscreant whose evil can not be stopped except through imprisonment.
Refraining from fulfilling someone's rights. For example a lazy debtor can be imprisoned (Abu Dawud 3628). Also includes anyone not observing religious obligations such as zakat, fasting etc.
Murder which has not or can not be punished by Qisas. For example, according to some madhabs this applies to a person who traps a victim of murder or one who indirectly causes his death. And according to the Malikis, a murderer who has been forgiven by the heirs of the victim is to be punished by lashing and imprisonment. And according to them the same applies in other cases where Qisas is not permissible.
For a range of other crimes which do not have fixed punishments, such as for men who imitate women and vice versa, professional singers, immoralities which do not qualify for the Hadd of Zina, theft which does not qualify for the Hadd, uncovering of 'awrah , bearing false witness, dealing in riba, cheating, selling wine, illegal hoarding etc.
There are also cases where imprisonment is used because of some need and is not meant as the actual punishment:
Imprisonment is permitted in war against disbelievers.
capture them and besiege them
ما كان لنبي أن يكون له أسرى حتى يثخن في الأرض
It is not for a prophet to have captives [of war] until he inflicts a massacre [upon Allah 's enemies] in the land.
فإذا لقيتم الذين كفروا فضرب الرقاب ... فشدوا الوثاق
So when you meet those who disbelieve [in battle], strike [their] necks ... then secure their bonds
And with certain limitations it is also permissible to temporarily imprison Muslim rebels who take up arms against the state.
Ref: Mawsoo‘ah al-Fiqhiyyah - volume 16 page 283-330 (حبس)