It’s a public safety issue. Even if murderers serve a full life sentence, which seems to be happening rarely these days, they still represent a serious threat to guards and other prisoners. There is also the possibility of prisoners being released by a future political regime.
+ + +
The pope’s statement is a prudential judgment, so it doesn’t rise to the level of infallibility.
The Church has always upheld the permissibility of capital punishment in principle.
I wouldn't even call it a "prudential" judgement.