Drug safety is a paramount concern in the field of drug development, with researchers increasingly focusing on the bidirectional regulation of gut microbiota in this context. The gut microbiota plays a crucial role in maintaining drug safety. It can influence drug transport processes in the body through various mechanisms, thereby modulating their efficacy and toxicity. The main mechanisms include: (1) The gut microbiota directly interacts with drugs, altering their chemical structure to reduce toxicity and enhance efficacy, thereby impacting drug transport mechanisms, drugs can also change the structure and abundance of gut bacteria; (2) bidirectional regulation of intestinal barrier permeability by gut microbiota, promoting the absorption of nontoxic drugs and inhibiting the absorption of toxic components; (3) bidirectional regulation of the expression and activity of transport proteins by gut microbiota, selectively promoting the absorption of effective components or inhibiting the absorption of toxic components. This bidirectional regulatory role enables the gut microbiota to play a key role in maintaining drug balance in the body and reducing adverse reactions. Understanding these regulatory mechanisms sheds light on novel approaches to minimize toxic side effects, enhance drug efficacy, and ultimately improve drug safety. This review systematically examines the bidirectional regulation of gut microbiota in drug transportation from the aforementioned aspects, emphasizing their significance in ensuring drug safety. Furthermore, it offers a prospective outlook from the standpoint of enhancing therapeutic efficacy and reducing drug toxicity, underscoring the importance of further exploration in this research domain. It aims to provide more effective strategies for drug development and treatment.