I think the etymology is from the Yiddish "m'shigas" (meh- shug-es) meaning craziness, also "meshugana" (meh-shoog-eh-nah) meaning crazy person.
So when you see something to deride as being exasperatingly crazy, you would say, "m'shigas". Over time and laziness, that has been shortened to "meh".