A locus classicus for this sort of puzzle is Aristotle’s Nicomachean Ethics:
That is generally held to be involuntary which is done under compulsion or through ignorance.
“Done under compulsion” means that the cause is external, the agent or patient contributing nothing towards it; as, for instance, if he were carried somewhere by a whirlwind or by men whom he could not resist.
But there is some question about acts done in order to avoid a greater evil, or to obtain some noble end; e.g. if a tyrant were to order you to do something disgraceful, having your parents or children in his power, who were to live if you did it, but to die if you did not—it is a matter of dispute whether such acts are involuntary or voluntary.
Throwing a cargo overboard in a storm is a somewhat analogous case. No one voluntarily throws away his property if nothing is to come of it, but any sensible person would do so to save the life of himself and the crew.
Acts of this kind, then, are of a mixed nature, but they more nearly resemble voluntary acts. For they are desired or chosen at the time when they are done, and the end or motive of an act is that which is in view at the time. In applying the terms voluntary and involuntary, therefore, we must consider the state of the agent’s mind at the time. Now, he wills the act at the time; for the cause which sets the limbs going lies in the agent in such cases, and where the cause lies in the agent, it rests with him to do or not to do.
Such acts, then, are voluntary, though in themselves [or apart from these qualifying circumstances] we may allow them to be involuntary; for no one would choose anything of this kind on its own account.
(Aristotle, Nicomachean Ethics, III.1, tr. F. H. Peters)
The basic idea here is that some acts are voluntary, some acts are involuntary, and some acts are mixed. In the case of jettisoning cargo from a ship during a storm, the act is voluntary in the sense that it is something that you yourself choose to do, for no one besides you is moving your limbs and jettisoning the cargo. Nevertheless, it is involuntary insofar as you did not ultimately want to jettison the cargo, and would not have done so absent the storm.
The same thing applies to your scenario. The act is voluntary insofar as you yourself are the one who hands over the wallet, but it is involuntary insofar as you do not ultimately want to be deprived of your wallet, and you would not hand it over except for the undesirable circumstances.
A difference between Aristotle’s scenario and your scenario is that in your scenario the undesirable circumstance is being intentionally created by another human being. This does introduce some important differences.
Supposing you refuse to hand over the wallet and are then killed, should we say that you have consented to be killed? That you have died willingly? If you thought the thief was telling the truth then there is a real sense in which you die willingly (just as someone who defies a tyrant would be said to willingly undergo the punishment threatened by the tyrant). If you thought the thief was bluffing, then the case is different.
In our modern world we seem to think of death as a kind of infinite reality, such that nothing could balance the cost of death (i.e. we would say that it is irrational to choose death in a barter). Where the consequence is conceived as finite there would be little reason to say that the consequence was not undergone willingly. For example, if the government tells you that you will be fined if you park on Central Ave without paying the meter, then by knowingly doing so you accept the fine voluntarily (and one might well do this in circumstances where the fine is deemed worthwhile). Still, even in this more clear-cut scenario “consent” is an odd word. Has he consented to be fined? I’m not sure. We would have to suss out what is meant by “consent.”