In most cases, insurance follows the car, not the driver. As long as the car owner gives you permission and has active insurance, you can legally drive their vehicle if you have an active driver’s license.
There are some additional factors you need to be aware of. Every insurance company has its own guidelines for what they will permit. Some car insurance companies have policies that only cover drivers listed on the declarations page. Others allow for “excluded drivers.” An excluded driver is someone who’s named in the policy as specifically not being covered by insurance in exchange for a lower premium. Whenever you borrow a car, have a conversion with the owner about the kind of coverage they have so that everyone knows they’re protected.
Here’s a great article that goes over this topic in more detail: https://getjerry.com/advice/does-my-car-insurance-cover-me-if-i-drive-someone-elses-car-by-nicholas-wilson.