Whether or not free will exists (I'm a compatiblist) there are certain cases where the threat of punishment will cause people to change how they act and there are certain cases where it won't. If it were the case the the people at Uber intended to kill someone then the threat of punishment might have prevented that and Elain Herzberg would still be alive. But as the people at Uber did not expect that their actions would result in her death the threat of punishment isn't going to be very effective at preventing deaths like hers.
The distinctions our legal system makes regarding coercion, mens rea, insanity, etc are mostly trying to get at this same underlying distinction.
The distinctions our legal system makes regarding coercion, mens rea, insanity, etc are mostly trying to get at this same underlying distinction.