If the disease is viral, then there is no cure and it will live with you forever. You will always be contagious to others. If the disease is bacterial, then there is a cure. This is called abstinence. Sexually transmitted diseases are spread through sexual contact without a condom.
Sexual contact can mean vaginal intercourse, anal intercourse, oral sex, kissing and touching.
All it takes is one incident of unprotected sexual contact to spread an infection. Sharing needles with someone who has an STD is one of the worst things you can do. Hundreds of thousands of people have been infected with an STD by sharing a needle with an infected person. The best way to avoid STDs is to abstain from sex. If you choose to have sex anyway, use a condom and talk to your partner about previous sexual relationships.