As long as SW is regularly bought, emulation is not just legally fine, but the best way to allow users to enjoy the game licenses they bought even after HW they originally ran on isn't supported anymore, and often to run at better resolutions and framerates than on original HW.
Piracy is bad, but there isn't a biunivocal relationship between it and emulation, and most often pirates don't like piracy through emulation, as they almost always want to pirate the latest games, and when games are new, emulation, if even already possible at all, is horribly slower and buggier than running cracked SW on original modded HW.