Ink cartridges and toner cartridges do have a shelf life. After around 12-18 months, cartridges sealed in original packages will expire. The ink inside toner can degrade, losing its quality.
Printer cartridges out of their seal will have a shorter life span. Cartridge installed in the printer can also expire and lose quality, especially those that aren't used for a while.
To preserve printer cartridges up to their optimal life span, you can click "How to Store Ink Cartridges and Toner Cartridges?"