To get needles from a pharmacy, you need a prescription only in New Jersey.
For all other states, you can legally buy them from a pharmacy. That's not to say all people who work at pharmacies are equally knowledgeable about the law (nor do they have to follow it, many people use their religious beliefs as an excuse to not do their jobs).
So, you can buy them from an online website, or you can visit a needle exchange.