If you found their private key by mathematical computation or guessing, I think it will not be considered illegal. But if you got that by using malware or trojan that may be illegal.
If you hacked Nobody can expect you can claim that wallet is yours.
In my opinion its an unjust enrichment case(And you are obliged to return it).Which is provided in the law of all countries.This norm protects owner's property,But in this situation,In crypto world, it may has only declaration-formal disposition.She/He don't have permission to find ''victim's'' private key,Its just a theft and illegal activity.(if you have intention.but somehow,if you find it without intention,it wouldn't be crime and this case is resolved by Private law and not by criminal law)