Selection bias occurs when the sample collected is not representative of the population intended to be analyzed, leading to skewed or invalid results. This bias can significantly affect the validity of research findings and can arise from various sources, such as non-random sampling, attrition, or self-selection of participants.