If two people live together before marriage and do not go to confession before their wedding in a Catholic Church, is their marriage valid in the eyes of the Church?
The validity of the sacrament does not depend on the holiness of the couple.
This is the meaning of the Church’s affirmation that the sacraments act ex opere operato [literally, “by the very fact of the action being performed”], i.e., by virtue of the saving work of Christ, accomplished once for all. It follows that “the sacrament is not wrought by the righteousness of either the celebrant or the recipient but by the power of God.” From the moment that a sacrament is celebrated in accordance with the intention of the Church, the power of Christ and his Spirit acts in and through it, independently of the personal holiness of the minister. (CCC 1128)