Yes you can sleep with someone who has an STD and not get the STD.
Simply sleeping with a person who has an STD won't cause you to get the STD yourself.
To get the STD you need to have sex with the person who has the STD or lick a persons Vagina and then you contract the STD.
But it's safe to just sleep with the person who is infected with an STD.
STDs can live on surfaces but only for a short amount of time.
STDs have the ability to live on the outside of the body for around 1 hour or less but any longer than 1 hour the STDs would have a hard time surviving.
That's why it's basically impossible to get STDs from toilet seats, towels etc.
But it's still good to disinfect surfaces such as toilet seats and also use a toilet seat cover on public toilet seats because you could get other infections that may live on the surfaces.
I always bring disinfecting wipes with me to public restrooms and wipe the toilet seat down before sitting on it and I also add some toilet paper to the toilet seat.
For an STD to live though it needs to be in the membrane to survive longer.