Edinburgh advises staff: "The actions to be taken will include consideration of reporting the matter to the police and children's panel reporter."
Dr Brian Potter, Scottish secretary of the British Medical Association, told The TES Scotland: "We have got ourselves into this crazy situation over child protection, to the point that the law is being interpreted to the detriment of young people's health.
"Teachers are in a unique position. They can have the respect of the young people they teach and can therefore give them support and help, but not if they cannot guarantee confidentiality."
Dr Potter said that if there were reasons why confidentiality could not be maintained, such as suspicions of an abusive relationship, it "should be broken with great care".
Deirdre Watson, director of the Scottish Child Law Centre, warned that any assumption "that all under-age sex is a child protection matter could result in more teenage pregnancies".
Hawys Kilday, director of Lothian Brook, the sexual health advisory centre for young people, said she understood the problem teachers faced, but they could help by "making young people aware there are confidential services available for them elsewhere".