Yes you can leave diapers in the car and they will be just fine.
When my kids were in diapers I always kept at least a few diapers in the glove compartment of my car along with some wipes.
Because it's always good to have spare diapers in the car because you'll need them eventually.
Sometimes if we were just gonna be gone for 4 hours at most the kids diapers would be okay until we returned home and even if they pooped in the diaper and we were gonna be home in less than an hour then I would wait until I got home to change the poop diaper.
I would usually shower the baby or toddlers butt off to remove the poop and sitting in a poop diaper for 30 to 40 minutes is not gonna harm them.
When storing diapers in the car it's best to store them out of the direct sunlight such as in the glove compartment or in the trunk of your car.
Also keep a spare set of clothes as well because sometimes diapers will leak onto clothes especially if the child is sitting in a car seat while they pee.