Some gyms have public yoga mats, just like barbells and dumbbells, for everyone to use. But it is generally used for stretching push-ups, which means that the action does not need to be very fine.
Yoga class is different. You usually need to bring your own yoga mat. Because of the different action requirements, the yoga mat is not like a barbell at this time, but like your clothes and pants. Sure, just bring it with you.