Foreign keys enforce referential integrity by ensuring that a value in one table corresponds to a valid value in another table. This prevents orphaned records and ensures that your data remains consistent and reliable. For example, in an order processing system, a foreign key can ensure that every order is associated with a valid customer record.