Streptococcus pneumoniae is a pathogen that causes serious respiratory disease and meningitis in the immunocompromised drug abuse population. However, the precise mechanisms by which drug abuse compromises the host immune defense to pulmonary S. pneumoniae infection is not fully understood. Using a well-established murine model of opiate abuse and S. pneumoniae lung infection, we explored the influence of morphine treatment on the interleukin-23 (IL-23)/IL-17 axis and related innate immunity. Impairment of early IL-23/IL-17 production caused by morphine treatment was associated with delayed neutrophil migration and decreased pneumococcal clearance. Furthermore, morphine treatment impaired MyD88-dependent IL-23 production in alveolar macrophages and dendritic cells in response to in vitro S. pneumoniae cell infection. Moreover, morphine treatment significantly inhibited the S. pneumoniae-induced phosphorylation of interferon response factor 3 (IRF3), ATF2, and NF-κBp65. T-cell receptor δ (TCRδ)-deficient mice showed a decrease in IL-17 production and a severely weakened capacity to clear lung S. pneumoniae infection. Finally, morphine treatment resulted in diminished secretion of antimicrobial proteins S100A9 and S100A8/A9 during early stages of S. pneumoniae infection. In conclusion, morphine treatment causes a dysfunction in IL-23-producing dendritic cells and macrophages and IL-17-producing γδT lymphocytes in response to S. pneumoniae lung infection. This leads to diminished release of antimicrobial S100A8/A9 proteins, compromised neutrophil recruitment, and more-severe infection.