It doesn't matter that they're locked up and can give each other the necessary pleasure, they've seen that there's a cock on the other side of the bars and they want to play with it too.