Radbaz Vol.3, siman 627 deals with the question, what if the Gentile Government says, allow me to amputate, one of your limbs that is not a vital, life threatening body limb or I will kill your fellow Israelite. Are you obligated to do so or not?
He answers that occasionally even amputating that type of limb can lead to death. He gives an example of someone who had his ear scratched to take out blood from it, and the guy ended up bleeding to death.
He further adds that although one is obligated to spend money to save a Jew, one is not obligated to risk his limbs. He adds the Torah's ways are the ways of pleasantness and the laws of the Torah have to be acceptable by the intellect, and logic dictates, how could it possibly be, that a man let his eye be blinded or hand or leg cut off, in order that his friend won't be put to death.
His conclusion is that it might be an act of piety beyond the strict requirement of the law, and praiseworthy if one that can stand by this measure, but it is not required. Furthermore he states if there is a real doubt {as opposed to an unlikely doubt} that the one who offers his limb can die from it, then in that situation one is called a pious fool {that is to say, he is doing something wrong) by sacrificing himself for the other person. For doubt that he personally will come to danger takes precedent over the definite danger of his friend.
In the case of Shalit, the prisoner exchange put the public in definite danger, while Shalit, was only in possible danger (since the Terrorists wanted him alive, with the hope that one day the Government would cave in to their demands, which indeed took place).
In a previous post, I provided 2 links to show, how similar deals in the past led to the murder of many Jews.