High Sierra should continue to receive security updates for the next few years so you don't need to buy a new iMac right away. Unfortunately Apple does not announce when they discontinue security updates for older macOS releases but the community has generally found it to be around three years after their initial release. Since macOS High Sierra was released a year ago, it'll likely continue to receive security updates until the summer of 2020. Not guaranteed though.
As a guideline, OS X El Capitan (version 10.11) was initially released in September 2015 and last received a security update in July 2018 and is probably the last security update it will receive. Likewise, OS X Yosemite (version 10.10) was initially released in October 2014 and last received a security update in Jul 2017. As you can see, there is a pattern of just under three years before Apple quietly stops support for older releases.
As chscag mentioned, you can always buy an external disc player that plugs into an iMac via an available USB port if when you upgrade to a newer iMac, you still need to use disc media once in a while. It's just obviously an extra expense to consider when you think about upgrading.