Suppose you believe that there are a small number of situations posing immediate peril to a large number of people, in which torture is absolutely necessary to elicit the key information that will prevent the peril, so that every nation in the world will practice torture under these circumstances.
At the same time you wish to deter the use of torture in every other circumstance, because you are worried about descending down the slippery slope to situations where a great peril is not imminent, or where the information elicited by torture is not necessary to prevent this great peril but is merely helpful to advance national security or other important interests.
The best way to achieve this set of goals would be not to carve out a legal exception for torture in emergencies but rather to impose a total ban. If the situation is so dire that torture is absolutely necessary to save a large number of people, illegality will not be a deterrent. Government officials will still commit torture. Then, after the fact, legal decisionmakers can determine whether their actions should be excused or pardoned.
Even if you excuse or pardon torture after the fact, however, you should not make evidence obtained by torture admissible in a subsequent military tribunal or criminal prosecution. If the torture was necessary to prevent an imminent and grave peril, the information should be used for that purpose, and that purpose alone. Otherwise you will indeed descend down the slippery slope, because you have created incentives for government officials to torture in order to elicit information for the purpose of assisting military or criminal prosecutions.