Let's recall what the Dependency Inversion Principle (DIP) states: high-level modules should not depend upon low-level modules; both should depend upon abstraction. This is a fundamental requirement for making any application modular and adjustable.
While designing any system, we should make sure that high-level classes do not instantiate low-level classes; instead, they should rely on abstraction (the interface or abstract class) rather than depending on other concrete classes directly. The DIP does not specify how this happens, so a technique is required to separate the low-level modules from the high-level modules. IoC provides this technique.
There are various patterns to achieve IoC, including inverting the object creation process from your class to some other class and reducing the coupling between modules or classes...