Video is meant to be viewed which means that if you are watching YouTube, the site expects that you must watch without listening to YouTube. The site allows you to create playlists, and if it's a playlist of music you're listening to, the tab doesn't actually have to be loaded. You can play background it minimizes the open YouTube window.
YouTube added this reminder about two years ago. It was sporadic at the time and not all users saw it. It only seems to appear if you're logged into YouTube and have been 'watching' for too long.
This feature is intended to save data and possibly battery life if you are viewing on a laptop that is not plugged in. If the video continues to play, it will consume more data, especially if you have autoplay enabled. The prompt is not without purpose but there should be an option to turn it off.
YouTube can't tell if it's in the background, but it can tell if you haven't interacted with the site in a while, and that's when it will pause the video playing. You will see the message ‘Video paused. Continue watching?'. You must click Yes to continue viewing.
How to turn off "Video paused. Resume watching?" on Youtube
To disable the “Video paused. Keep Watching”, you have to use an extension called YouTube NonStop. This is a Chrome extension so this solution only applies to Chrome.
Install YouTube NonStop from the Chrome Web Store and it will configure everything on its own. You can leave YouTube running in the background and the extension won't stop playing videos when you haven't interacted with the site for a long time.
You cannot enable or disable this extension. You can disable this feature if you want it to work again (or uninstall) but there is no disable button.
If you prefer Firefox to Chrome, there seems to be no add-on that can remove this feature.