The straightforward answer is to buy the game. StarCraft is inexpensive, and Battle.net requires a valid, registered key to play online, so a downloaded copy alone won't connect you to official servers.
Buying a legitimate key is easy and cheap. Authorised digital retailers sell keys for StarCraft, Diablo, Counter-Strike and plenty of others, often for a few pounds, and you get a legal licence you can reinstall forever. It beats paying for a disc you'll scratch.
There are private servers that don't check keys, but they're unofficial, often sparsely populated, and no substitute for Battle.net if you want to play against a friend on the real ladder. Since StarCraft and its expansion were later made free by Blizzard anyway, the legitimate route costs nothing.