This might be a stupid question but I'm curious

Can you get an STD from someone who doesn't have it? If not, why do people who have STDs continue having sex with new people if they know they have it? That's so careless.