Illegal can be things that hasn't yet regulated or made legal. Autonomous driving car, advanced ai even travelling to mars are things that yet not exists, thus are illegal at time they exists.
Recent examples are GDPR, where before it isn't regulated to track user information without consent, now being prohibited with clear penalty. Next they should regulate personal assistance like alexa and siri