From what I understand, it's due to syllable structure. As "Un francophone" says, [e] and [ɛ] often vary in French.
The most common cause of variation is due to the "loi de position" which is based on syllable structure. In general, [e], [o] and [ø] show up more frequently in open syllables (syllables that end in vowels) and [ɛ], [ɔ] and [œ] show up more frequently in closed syllables (syllables that end in consonants). The "loi de position" has systematic exceptions for many speakers, and there are other factors that affect vowel quality, but it's one phenomenon to keep in mind.
For some speakers, [e] cannot be used in a closed syllable (one that ends in a consonant). The elision of the historical schwa in the middle of "médecin" forces the "d" into the previous syllable, making it closed. So as a result, some people use /ɛ/ here. Apparently, the spelling was established before schwa elision was common.
Another word that shows the same phenomenon, and that actually can be spelled with è to show the pronunciation with /ɛ/, is événement/évènement.
Eau qui dort pointed out in a comment that the phenomenon of vowel height assimilation (one of the "other factors" that I skimmed over earlier) may also play a role here: in non-final syllables, /e/ in French is often likely to be lowered to /ɛ/ when followed by a low or mid-low vowel such as /ɛ̃/. This may explain the difference between Eau qui dort's pronunciations of médecin [mɛtsæ̃] and détenu [deːtny].