Veterinary drugs heavily used in livestock are passed into the environment through different ways, resulting in risks to terrestrial environments and humans. The migration of toltrazuril (TOL), an important anticoccidial drug used intensively in livestock, and its main metabolites between the chicken manure compost, soil and vegetables was investigated, and then the impacts of TOL on the soil bacterial community and ARGs, soil enzyme activities and phytotoxicity were detected. In the process of aerobic composting for 80 days, except for toltrazuril sulfoxide (the degradation half-life was 59.74d), TOL and ponazuril (PON) were not significantly degraded. However, TOL and its metabolites were significantly degraded in fertilized soil, and the degradation half-life was 28.17-346.50d. Among the three drugs, only PON could migrate from soil to vegetables, and the residual concentrations of PON in lettuce and radish were 2.64-70.02μgkg-1 and 0-2.80μgkg-1, respectively. Moreover, TOL and its main metabolisms had no significant effect on the bacterial community structure and the abundance of antibiotic resistance genes during composting, but affected the microbial activity in the soil. The presence of TOL and its main metabolites reduced soil urease activity, increased catalase activity, and decreased alkaline phosphatase activity at the beginning and then increased slightly. They had negative effects on plant growth. Compared with the control group, the inhibition rates of TOL and its metabolites on lettuce and radish seed germination were 8.33% and 26.74% respectively, and the inhibition rates of root elongation length were 25.88% and 34.45% respectively. These results showed that TOL and its main metabolites were ineffectively removed by aerobic composting, and could be migrated from composting to soil and vegetables, which had adverse effects on soil enzyme activity and plant growth. Therefore, its environmental ecological risk and human health risk needs to be further evaluated.