In humans and other mammals it is known that calcium and phosphate ions are secreted from the distal small intestine into the lumen. However, why this secretion occurs is unclear. Here, we show that the process leads to the formation of amorphous magnesium-substituted calcium phosphate nanoparticles that trap soluble macromolecules, such as bacterial peptidoglycan and orally fed protein antigens, in the lumen and transport them to immune cells of the intestinal tissue. The macromolecule-containing nanoparticles utilize epithelial M cells to enter Peyer's patches, small areas of the intestine concentrated with particle-scavenging immune cells. In wild-type mice, intestinal immune cells containing these naturally formed nanoparticles expressed the immune tolerance-associated molecule 'programmed death-ligand 1', whereas in NOD1/2 double knockout mice, which cannot recognize peptidoglycan, programmed death-ligand 1 was undetected. Our results explain a role for constitutively formed calcium phosphate nanoparticles in the gut lumen and show how this helps to shape intestinal immune homeostasis.