iTunes 11 Import Into Apple Music
Though Apple's monthly music subscription service offers similar functionality, I think the feature you're looking for is iTunes Match.

iTunes Match enables storing your music in the iTunes Cloud Library (as long as you don't have more than 100,000 songs to store in the cloud). It'll scan your library, match the songs to ones already in Apple's extensive library (to avoid uploading them), and upload the songs that it can't match. Once all your songs are uploaded or matched from your old iMac, you'll be able to pull them down onto other iOS and macOS devices — you'll either be able to stream them on demand or download them.

iTunes Match should be available in iTunes version 10 and later.

Here's some further info:


Apple – iTunes Match
iMore – Apple Music vs iTunes Match