"middle; being the middle part or midst; being between, intermediate," Old English mid, midd from Proto-Germanic *medja- (source also of Old Norse miðr, Old Saxon middi, Old Frisian midde, Middle Dutch mydde, Old High German mitti, German mitte, Gothic midjis "mid, middle"), from PIE root *medhyo- "middle."
By late Middle English probably felt as a prefix only, and now surviving in English only as a prefix (mid-air, midstream, etc.). Prefixed to months, seasons, etc. from late Old English. As a preposition, "in the middle of, amid" (c. 1400) it is from in midde or a shortened form of amid (compare midshipman) and sometimes is written 'mid.
"with," a preposition formerly in common use but now entirely superseded by with (except in the compound midwife) from Old English mid "with, in conjunction with, in company with, together with, among, at the same time as," and in part from cognate Old Norse mið, from Proto-Germanic *medthi- (source also of Old Saxon mid, Old Frisian mith "together with, with the help of," Dutch met, Old High German and German mit, Danish med, Gothic miþ "with"), from PIE *meti-, suffixed form of root *me- "in the middle" (compare meta-).