I found a hint on phrases.org:
It is a construction in use in English since the Middle Ages: it means "in consequence of, on account of, as a result of; in view of, considering (one thing and another)".
Centuries ago English people also said "What through..." and "What for..." which meant the same thing; but these expressions are now obsolete.
But that's too vague for my taste, so let's dig deeper. Grammarphobia has more information about the parsing of such structures:
This construction has a folksy, contemporary sound, but it’s neither. It’s been around since the Middle Ages and appears in the most elevated writing.
Here “what” is used to introduce an adverbial phrase that starts with a preposition, and the preposition is generally “with.”
About its origin timewise, the site says
This use of “what” has been around since the 1100s, the OED says, although in the very earliest examples the preposition was “for,” as in this quotation from the Lambeth Homilies (circa 1175), a collection of Old English sermons:
Alle we beoð in monifald wawe ine þisse wreche liue, hwat for ure eldere werkes, hwat for ure aȝene gultes. (“We are all in manifold woe in this wretched life, what for our elders’ deeds, what for our own guilts”).
The actual phrase we are looking into, what with:
began showing up in English writing in the 15th century, the OED says. The dictionary’s earliest example is from a 1476 letter that John Paston wrote from Calais to his family back home in Norfolk:
I ame some-whatt crased [ill], whatwyth the see [sea] and what wythe thys dyet [diet] heere.
Now, how and why this expression has come to mean what it means is not explained in the sources I have found, although the Grammarphobia's parsing and the other original forms of the phrase shed some light. It may be related to the fact that Old English hwæt used to also mean why:
Old English hwæt, referring to things in abstraction; also "why, wherefore; indeed, surely, truly," (Etymonline)