Yes, you can get an STD from sexual contact other than intercourse or from sharing needles with someone infected or from skin-to-skin contact in some cases. You typically cannot get STDs from casual contact or touching objects or surfaces.