The new rules will apply for pupils in their senior phase, who are usually aged 15 to 18.
Only those in areas under the two highest alert levels for coronavirus will be affected.
The new guidance says students in year groups S4 to S6 must wear face masks in classrooms if they are in places classified as Level 3 or 4.
Secondary school pupils in Scotland already have to wear face coverings in corridors, communal areas and on buses.
“The evidence suggests there is slightly higher infection and transmission risks for people around the age of 16 to 17 so the use of face coverings is an additional precautionary measure in areas where there is increased incidence of the virus,” Scotland’s deputy first minister said.
The new guidance over face masks comes after the Scottish government revealed a new tiered system for coronavirus restrictions, which will come into force from Monday.
The majority of Scots will be placed into Level 3, with the rest of the country in either Levels 1 or 2, Nicola Sturgeon said.
Scotland’s central belt – including Edinburgh, Glasgow, Stirling and Falkirk – will be joined by Dundee and Ayrshire in Level 3, the second-highest tier.
“Keeping schools open remains our priority but that can only be the case if schools are safe," the Scottish deputy first minister said, following the publication of new guidance for schools in these areas.
“This strengthened guidance, produced in light of updated scientific and health advice, adds to the health mitigations that have been in place since schools opened in August,” John Swinney, the deputy first minister, said.
“From Monday, there will be increased use of face coverings and new advice to help protect those in the shielding category."
Under the new guidance, adults are also being advised to wear face coverings in schools where they cannot stay at least two metres away from other adults and pupils - although there were some exemptions to this for primaries one and two.
Staff in primary schools should now wear face coverings in communal areas, such as staff rooms, canteens and corridors, while parents and other visitors should wear face coverings even if they are not entering the building, Mr Swinney said.
Additional reporting by Press Association