[1] The widespread occurrence of magnetotactic bacteria (MTB) in several types of marine and freshwater sediment, and the role of fossil magnetosomes (magnetofossils) as main remanent magnetization carriers therein, has important paleomagnetic and paleoenvironmental implications. Despite numerous studies on MTB biology and on magnetofossil preservation in geological records, no detailed information is yet available on how magnetotaxis (i.e., the ability to navigate along magnetic field lines) is performed in sedimentary environments, and on how magnetofossils possibly record the Earth magnetic field. We provide for the first time experimental evidence for these processes. MTB living in sediment are poorly aligned with the geomagnetic field, contrary to what is observed in water. This can explain the seemingly excessive magnetic moment of most MTB. The observed alignment is sufficient for supporting magnetotaxis across the typical thickness of chemical gradients. Experiments with magnetofossil-rich sediment suggest that a natural remanent magnetization (NRM) is acquired by magnetofossils in the so-called benthic mixed layer, where natural MTB populations usually occur. The acquired NRM is proportional to the applied field at least up to $160 mT, and its intensity is compatible with values observed in nature for same sediment types. Therefore, if fossil magnetosome chains are not subjected to further alteration by early diagenetic processes, they can provide useful relative paleointensities. We propose a preliminary model to explain early stages of magnetofossil NRM acquisition as the result of a dynamic equilibrium between magnetic torques and randomizing forces due to sediment mixing.