Position-Independent Code (PIC) is a type of machine code that executes correctly regardless of its absolute memory address, enabling it to be used in shared libraries and dynamic loading. By using relative addressing, PIC enhances security through techniques like Address Space Layout Randomization (ASLR) and optimizes memory usage by allowing multiple programs to share a single copy of the code in memory.