At what age can you get prescribed medication from a doctor on your own?

Depends. For what? In general, you need to be 18 to be able to give 'consent' = accepting a medication with an understanding of the risks and benefits. On occasion, doctors may prescribe medications for minor illness with what is called 'implied consent' -- previous written permission from parents to treat. Some ob-gyns may prescribe birth control pills to protect against teen pregnancy when parents disagree.
State & condition. This varies by the state and the issue at hand. The common answer for most is when they reach the age of legal consent, which for many is 18. In fact I must get an 18 yo's consent to tell their parent the results of any lab test. Many states carve out STD/pregnancy & birth control as something a minor can request outside of parental notification or consent. ( as a public health issue)