what happens after the wedding does not determine the validity of the marriage. The conditions that pertain at the time of the contract determine validity. In general, the Catholic Church assumes that two people who are otherwise free to marry, are will and able to give full free will consent, are validly married. Where and by whom is an issue only for Catholics. Two non-baptized persons, or one bapt-one not bapt, have a valid natural marriage. Two baptized persons have a valid and sacramental marriage.
If they divorce and either seeks to remarry a Catholic the validity of the first marriage must be indentified and judged by the marriage tribunal of the diocese to determine if the marriage was valid from its inception. If not, they are not free to marry.
every marriage situation is unique, this is a hypothetical case only, and each marriage situation must be investigated and resolved before the parties are free to marry again. If either party seeking to remarry has used BC or plans to, or has had an abortion or would do so, they cannot validly marry in any case if they cling to that determination, so education and pastoral counselling must be part of the marriage preparation if they do seek to marry a Catholic.