Since it's due to the law that they are his/her parents by proxy, why isn't the phrase 'by-law' instead of 'in-law'?
The question came up in Stack Exchange ELU :
ELU "Where's in-law in mother-in-law from"
The second answer shows the OED etymology, which mentions "in the eye of the canon law".
The phrase "in the eye of the law" in general is very common:
Google books "in the eye of the law"
Just searching for "in law" produces this google definition
"at (or in) law: according to or concerned with the laws of a country."
so the preposition "in" is sometimes used with "law" in this sense.
The use of "in law" in "parent-in-law" has a lot of precedent and is not an oddity. The phrase "by law" is common too, but it isn't used in this context.