The last operating system supported by your mid-2011 iMac is High Sierra (10.13.6) — which Apple will provide Security updates to into early Fall 2020:
How to upgrade to macOS High Sierra.
Your mid-2011 iMac is on Apple's Vintage and Obsolete product list, and unless you reside in California, Apple has discontinued hardware service for it. You can continue to use the iMac until it fails, but won't be able to get it repaired by Apple. Depending on your budget, you can continue using the iMac for another year, or purchase a newer Mac product (even one from Apple's refurbished products).