The primary purpose of an IP address is to enable the identification and location of devices on a network. It acts as a virtual address, similar to a physical postal address, allowing data packets to be routed correctly between devices on the internet.