Friction due to fabrics rubbing against each other can produce static electricity. This charge can be released when the fabrics are separated. We only notice the charge exchange when at least one of the fabrics has a huge resistance to electrical flow.