Lying from the perspective of Islam
Given that lying is one of the greater sins and is in fact the key to other sins, man should always avoid it.
Question: In what cases has Islam considered lying to be expedient and permissible?
Response: Given that lying is one of the greater sins and in fact is the key to other sins, man should always avoid it but sometimes this greater sin is allowed and sometimes becomes obligatory. Therefore, it is obligatory for us to know the conditions in which lying is permissible or obligatory.
We bring some of these cases which are mentioned in the books of fiqh al-istidlali (demonstrative jurisprudence):
1. Necessity and urgency: If the protection of the life and property of a person or a religious brother can be stopped by lying, man can lie because such a lie preserves the life and property of a respected person and the importance of the holy shari’ah concerning the life and property of Muslims is an obvious and indisputable matter.
There are several reasons for permitting lying in cases of necessity and urgency, one of these reasons is the holy verse of the Holy Quran, “Excepting someone who is compelled [to recant his faith] while his heart is at rest in it, those who disbelieve in God after [affirming] their faith and open up their breasts to unfaith, God’s wrath shall be upon them and there is a great punishment for them.” 
With faith – yes, those who open their hearts to accept disbelief, the wrath of God is upon them and a great punishment awaits them!
This blessed verse indicates that expressing disbelief is not forbidden out of compulsion and reluctance, but out of necessity and saving one’s life.
In another verse, God says: “The faithful should not take the faithless for allies instead of the faithful, and God will have nothing to do with those who do that, except when you are wary of them, out of caution. God warns you to beware of [disobeying] Him, and toward God is the return.”  According to this verse of the Quran, if a person clearly sees that if he does not express friendship with the disbelievers, his life and rubbing will be in danger, then here, expressing love to them is permitted. That is, in principle, expressing love and guardianship for the disbelievers is forbidden and can even cause them to leave the religion but it is not forbidden in the position of necessity and the protection of life.
The narrations also convey this theme: “Nothing is forbidden unless God Almighty has made it lawful for the distressed person.” 
2. Reform among the believing brothers: One of the places where lying is permissible is the will to bring about reform between two people, and through this, if two people or two tribes or clans have ambiguity and enmity with each other and someone comes to make peace between them, and lies with this intention, he has not done anything forbidden. There is a lot of information in this regard.  In a narration from the Holy Prophet of Islam (Muhammad), it is stated: “Oh Ali! God loves a lie that is made on the path of reform among the people and hates the lie that causes corruption.”  And in another narration from Imam Ja’far al-Sadiq, it is stated: “A reformer is not considered a liar.”  Imam Khomeyni has relied on these two narrations to allow lying in cases of reforming. 
3. Deception in war: In the battle between right and wrong, deception and clever deception deceive the enemy, strengthens the right and the wrong weakness, and is therefore acceptable. In a narration of Imam Ja’far al-Sadiq from the Prophet, it is stated: “In three cases, it is a good lie, including three cases of deception and deception in war.” And in another narration, it is stated: “Every lie is questioned and interrogated except in three cases, one of which is deception in the war.” 
Summary and conclusion: In general, in any case where a lie is told and its purpose is to ward off evil and harm from a Muslim or the goal is to reform among the people, not only is lying not forbidden, but it is beautiful and pleasing because this lie is no longer the key to sins, but goodness and kindness to people. Of course, such a lie is also permissible and acceptable when it is not possible to tell the truth, in which case lying becomes permissible or obligatory, and telling the truth is prohibited or forbidden.
In conclusion, it should be noted that expedient lying is possible only in the above cases, i.e. cases where leaving it causes restrictions and losses that are impossible to compensate but lying for the purpose of material use or for personal gain and the like is not a part of expedient lying and it is definitely forbidden and subject to the verses and narrations of the sanctity of lying and it will cause humiliation and misery in this material world and the hereafter.
1. Holy Quran 16:106
مَن كَفَرَ بِاللَّـهِ مِن بَعْدِ إِيمَانِهِ إِلَّا مَنْ أُكْرِهَ وَقَلْبُهُ مُطْمَئِنٌّ بِالْإِيمَانِ وَلَـٰكِن مَّن شَرَحَ بِالْكُفْرِ صَدْرًا فَعَلَيْهِمْ غَضَبٌ مِّنَ اللَّـهِ وَلَهُمْ عَذَابٌ عَظِيمٌ
2. Holy Quran 3:28
لَّا يَتَّخِذِ الْمُؤْمِنُونَ الْكَافِرِينَ أَوْلِيَاءَ مِن دُونِ الْمُؤْمِنِينَ ۖ وَمَن يَفْعَلْ ذَٰلِكَ فَلَيْسَ مِنَ اللَّـهِ فِي شَيْءٍ إِلَّا أَن تَتَّقُوا مِنْهُمْ تُقَاةً ۗ وَيُحَذِّرُكُمُ اللَّـهُ نَفْسَهُ ۗ وَإِلَى اللَّـهِ الْمَصِيرُ
3. ما من شيء إلّا و قد أحلّه اللّه لمن اضطرّ إليه”
See: Shaykh Ansari, Murtadha, “al-Makasib,” Qom, Shaykh Ansari World Congress, I, 1415 AH, vol. 2, pp. 21-31.
4. Shaykh Ansari, “al-Makasib,” vol. 2, pp. 31-32.
5. al-Hurr al-Amili, Muhammad ibn al-Hasan, “Wasail al-Shi’ah,” Qom, Ahl al-Bayt Institute, vol. 12, p. 252.
6. al-Hurr al-Amili, Muhammad ibn al-Hasan, “Wasail al-Shi’ah,” vol. 12, p. 252.
7. Imam Khomeyni, “al-Makasib al-Muharramah,” Qom, Institute for Organizing and Publishing the Works of Imam Khomeyni, I, 1415 AH, vol. 2, p. 138.
8. al-Hurr al-Amili, Muhammad ibn al-Hasan, “Wasail al-Shi’ah,” vol. 12, p. 252.