The thread will be ok from such a brief exposure. Even a longer exposure...it will dry. So will the pearls.
I don't think you have to worry about the pearls or the thread in the examples you gave.
But it actually is the pearls one has to think about; if one wears pearls in a chlorinated pool, or bathes or showers in chlorinated water, the pearls are being exposed to chlorine, which isn't good for them.
If one wears the pearls while swimming in a pond or the ocean, the necklace may absorb funky odors. If one doesn't rinse off salty sea water after a swim, salt could dry on the pearls or on the thread inside the drill holes.
And then there is the clasp metal to consider. Chlorine damages gold alloys. White gold is more vulnerable than yellow gold. Before my daughter was born, part of my workday as a physical therapist was spent at a therapeutic pool. I was newly engaged and wore my white gold engagement ring while working in the pool. After 6 months of that I had to get the prongs repaired! The chlorine just ate them away. I could have lost my diamond.
Basically one should not wear jewelry while swimming. Pearls or any other jewelry.
I wonder how many people have lost jewelry while swimming.
(I realize some folks wear Tahitian pearls on leather while swimming or surfing in the ocean.)