The young people - aged 15 and 16 - have been "deliberately risking their health", Wiltshire Police said.
Xanax is prescribed by doctors to treat severe anxiety or panic disorder.
Parents and guardians in Salisbury are being urged to talk to their children about the risks of taking drugs that have not been prescribed for them.
Insp Pete Sparrow said the force was "concerned about these incidents".
More on this story and others from the West of England.
"The effects of taking any drugs which haven't been specifically prescribed for you can have serious or even fatal consequences," he said.
"We are investigating where the supply to these young people has come from and ask that anyone with information comes forward."
A spokesperson for the force said the teenagers were "now recovering".
Ceri Williams, from Wiltshire Council, said it was "already engaging" with young people in Salisbury to make them aware of the risks.
"We would encourage people to contact Motiv8 if they have any concerns relating to Xanax or any other substances," he said.
Up to 20 teenagers in Wiltshire have needed medical treatment after taking the prescription drug Xanax in the last week, police have said.