Shulchan Aruch Yoreh Deah 252:3 Every moment that one delays in freeing captives, in cases where it is possible to expedite their freedom, is considered to be tantamount to murder.
Rambam: "The redeeming of captives takes precedence over supporting the poor or clothing them. There is no greater mitzvah than redeeming captives for the problems of the captive include being hungry, thirsty, unclothed, and they are in danger of their lives too. Ignoring the need to redeem captives goes against these Torah laws: “Do not harden your heart or shut your hand against your needy fellow” (Devarim 15:7); “Do not stand idly by while your neighbor’s blood is shed” (Vayikra 19:16). And misses out on the following mitzvot: “You must surely open your hand to him or her” (Devarim15:8); “...Love your neighbor as yourself” (Vayikra 19:18); “Rescue those who are drawn to death” (Proverbs 24:11) and there is no mitzvah greater than the redeeming of captives."