Current canon law requires Christian marriage to include the consent of the couple, a lack of impediments that would make it impossible to marry (e.g., one of the spouses is already married), and the proper form of marriage.
This last one – “proper form” – is something that is defined by a Church or a denomination. Since it has to do with the liturgy in which the wedding takes place, it’s something that a Church is able to define on its own (or modify as it sees fit). Protestant denominations tend not to have requirements of form, so the Catholic Church sees a wedding between two Protestants as valid regardless where it takes place (church, beach, Elvis chapel) or who performs the ceremony (minister, JP, guy dressed like Elvis).
The Catholic Church does have rules for form – weddings take place in a church, and are celebrated by a priest or deacon – so, for a wedding to be valid, these are necessary. Remember, though, that a Church gets to make these definitions as it sees fit: so, before the Church defined what proper ‘form’ was, weddings between Catholics were already valid and sacramental, even if the Church wasn’t there to witness them. Once the Church did define ‘proper form’, then it became necessary to follow that form in order to have a valid marriage.
When I learned to drive, I was taught that, on country roads without speed limit signs, I should go 35 mph. If a country road later got a sign that said ‘25 mph’, that doesn’t mean I was driving illegally all those times I was on that road earlier. From that point on, though, I had to drive 25 if I wanted to drive legally. It’s kinda the same thing with the ‘form of marriage’…