Virtual functions in object-oriented programming enable polymorphism by allowing derived classes to override base class methods. This mechanism ensures that the correct function is called for an object, regardless of the reference type used to invoke it, enhancing flexibility and reusability in code design.