What happens if an unlicensed driver is driving insured car and has accident and not at fault?

You must be licensed to drive, or have a permit and a licensed driver with you. Otherwise, there are legal consequences for that driver. The insurance company may not pay for any damages depending on the policy.