Visa and mastercard can do anything they want as long as they want to do it. They just don't want to deal with porn by choice
It also isn’t actually that uncommon for companies to make decisions for moral reasons, for all that we talk of corporations as money-hungry husks they are ultimately made up of people and have their own internal culture. Traditionally they’d eventually be outcompeted by a company who doesn’t have an issue with the action, but given the stranglehold Visa/MasterCard have on the industry that seems unlikely in this case.