The I2C is a very powerful feature that often is not understood by entry level users.
The I2C is a serial protocol developed by Philips back in the early eighties, its purpose was to reduce the componentry allowing control of separate modules be it in Industrial or Automotive applications later appeared in domestic products like TV and Video Recorders.
en.wikipedia.org
The application today allows bidirectional data exchange at up to 3.4 Mb/s and 5 Mb/s unidirectional, the device has an individual address so that up to 1008 nodes (Devices) can be implemented utilizing the 10 bit address scheme.
As the Arduino provides a limited amount of ports, and the designed application requires to control more than what is provided there exist several ways to expand the capability, but using the I2C is by far the simplest way..
CAVEAT - The I2C is driven via the Arduino Interrupt system, here the function will only behave as well as the library code used allows, what I am saying as the Arduino as an open source platform there exists some real crappy library code, if having problems use an alternate library,
I found similar with the RS232 virtual port library on my GPS OCXO project.
There are many I2C I/O expansion modules for the Arduino available on the market that are not that expensive.
If designing an application that requires the acquisition or to drive outputs like relay and switches these modules will provide your design these requirements, a good solution.
This Adafruit MCP23017 I2C GPIO Expander Breakout has 16 GPIO with matching ground pad. It runs happily from 3V or 5V logic and power. With 3 address pins, you can have up to 8 on a single bus for a total of 8 x 16 = 128 GPIO all on one I2C bus!
learn.adafruit.com