In effect, you "moved" during 2017. Therefore you'll need to file two part-year resident state tax returns for 2017: one for your military State of Residence, and one for the state you began living in after retirement. You can be taxed by MO for your income up until you began living in MD. MD can tax all your income after that date.
This FAQ explains how to file a part-year resident return in TurboTax: https://ttlc.intuit.com/questions/1901227-how-do-i-file-a-part-year-state-return
**Answers are correct to the best of my ability but do not constitute tax or legal advice.