How do people get sti or stds?

Like does it happen to everyone having sex?