Developing on-site biomarker enrichment platforms could help to improve the diagnosis of gastrointestinal (GI) tract diseases at early stages. Medical procedures, such as colonoscopies and imaging techniques, are used to diagnose disease, but are not easily accessible for repeat measurements. In the other hand, liquid biopsies, e.g., blood, urine, or fecal samples, have become important sampling strategies to identify health concerns. Herein, a robotic pill is designed for collecting relevant biomarkers from the GI over prolonged sampling periods. The robotic pill comprises a magnetic core for locomotion, a delayed gate mechanism that controls sampling location based on changes in its environment, and an enrichment module that traps biomarkers in an absorbent matrix while enabling biofluid to pass through the chamber. The robotic pill was assessed to sample microparticles, proteins, and bacteria from solution. Moreover, the robotic pill was capable of directed locomotion in complex environments and docking in a targeted region against fluid flow. Utilization of an untethered robotic sampling system could provide a tool to investigate aspects of disease initiation and progression for early diagnosis and therapy monitoring.