(1) If a thing can’t be done without something wrong being done, then the thing itself is wrong.
(2) If X is impossible and Y is wrong, then I can’t do both X and Y, and I can’t do X but not Y.
But if Y is wrong and doing X-but-not-Y is impossible, then by (1) it’s wrong to do X.
Hence if it’s impossible to do a thing, then it’s wrong to do it.