Although conventional biological treatment plants can remove basic pollutants, they are ineffective at removing recalcitrant pollutants. Membrane bioreactors contain promising technology and have the advantages of better effluent quality and lower sludge production compared to those of conventional biological treatment processes. In this study, the removal of pharmaceutical compounds by membrane bioreactors under different solid retention times (SRTs) was investigated. To study the effect of SRT on the removal of emerging pharmaceuticals, the levels of pharmaceuticals were measured over 96 days for the following retention times: 20, 30, and 40-day SRT. It was found that the 40-day SRT had the optimum performance in terms of the pharmaceuticals' elimination. The removal efficiencies of the chemical oxygen demand (COD) for each selected SRT were higher than 96% at steady-state conditions. The highest degradation efficiency was observed for paracetamol. Paracetamol was the most removed compound followed by ranitidine, atenolol, bezafibrate, diclofenac, and carbamazepine. The microbial community at the phylum level was also analyzed to understand the biodegradability of pharmaceuticals. It was noticed that the Proteobacteria phylum increased from 46.8% to 60.0% after 96 days with the pharmaceuticals. The Actinobacteria class, which can metabolize paracetamol, carbamazepine, and atenolol, was also increased from 9.1% to 17.9% after adding pharmaceuticals. The by-products of diclofenac, bezafibrate, and carbamazepine were observed in the effluent samples.