The First Minister said emergency legislation will also introduce a “moratorium on evictions” to give people security this winter.
It came as she set out her Government’s legislative programme for the coming parliamentary year.
Ms Sturgeon said rail fares on ScotRail, which was brought into public ownership earlier this year, will be frozen until at least March 2023.
Elsewhere, she repeated her call for new Prime Minister Liz Truss to freeze energy bills and renewed her plea for an emergency four nations summit on the “cost crisis”.
The First Minister said the Scottish Government’s budget is under “severe and increasing pressure”, while public sector pay deals have so far cost £700 million more than anticipated. She warned of “hard choices” and cuts elsewhere in the budget. More detail is expected on Wednesday.
Scottish Conservative leader Douglas Ross said her plans fell “woefully short of rising to the big challenges we face”.
Meanwhile, John Blackwood, chief executive of the Scottish Association of Landlords, accused ministers of “attacking landlords for political reasons”.
He said he had been “inundated by landlords saying they will be removing their vacant properties from the rental market”.
Mr Blackwood added: “Instead of helping tenants pay their bills, the Scottish Government has chosen to penalise people who have provided the homes politicians have failed to provide for decades.”
Sally Thomas, chief executive at the Scottish Federation of Housing Associations, warned a rent freeze without increased Government support could jeopardise affordable home targets.
Speaking in Holyrood as the Programme for Government was published, Ms Sturgeon confirmed “immediate action to protect tenants in private and in the social rented sectors”.
She said: "I can announce that we will shortly introduce emergency legislation to Parliament.
"The purpose of the emergency law will be two-fold. Firstly, it will aim to give people security about the roof over their heads this winter through a moratorium on evictions.
"Secondly, the legislation will include measures to deliver a rent freeze.
"The Scottish Government does not have the power to stop your energy bills soaring, but we can and will take action to ensure that your rent does not rise.”
She said the measures were temporary, but “will provide much needed security for many during what will be a difficult winter”.
Ms Sturgeon added: “We envisage that both measures will remain in place until at least the end of March next year.
"And crucially, I can confirm that we will time the emergency legislation to ensure, subject of course to Parliament’s agreement, that the practical effect of this statement is that rents are frozen from today.”
Her comments came as she confirmed her Government would bring in a Bill to hold a second independence referendum in October next year – if ministers get the go-ahead on this from the UK Supreme Court.
Ms Sturgeon said the cost-of-living crisis “highlights – starkly – the pressing need for independence”.
Elsewhere, she said free school meals would be extended to all pupils in primaries six and seven.
She also highlighted the creation of a National Care Service and education reforms to establish an independent inspectorate and a new public body responsible for qualifications.
The Programme for Government includes plans to increase the Scottish Child Payment to £25 per week from November 14, when it will also be extended to under-16s.
Meanwhile, a Local Visitor Levy Bill will give councils the power to introduce a tourist tax.
This was welcomed by Cammy Day, the leader of Edinburgh City Council, which previously estimated such a levy could raise around £15 million per year.
He said: “This is fantastic news for the city, and a landmark step following years of work here in the capital to make the case for a visitor levy – something that’s common practice in other major cities and destinations across the world.”
Mr Ross accused the First Minister of “directing blame elsewhere and seeking grievance with the UK Government”.
He said: “When Scottish people are struggling with their bills, instead of the right level of help, they’ll get another unwanted bill from the SNP Government – an Indyref2 Bill.
“This SNP Government are giving precedence to planning for a vote on separation, which they know will divide Scotland at exactly the point we should be coming together and uniting. A vote that is the wrong priority at the worst possible time.”
Scottish Labour leader Anas Sarwar welcomed the Scottish Government’s “change of heart” on rent freezes.
A proposal by Labour MSP Mercedes Villalba aimed to freeze rent for around two years until controls were introduced.
But the motion was rejected by SNP, Tory and Green MSPs in June following a parliamentary vote.
Mr Sarwar said: “I want to welcome the change of heart from the SNP and the Greens when it comes to rent freezes.
“This is a practical measure that will support many people who need help now.
“I’m glad that months of campaigning from my colleague Mercedes Villalba and the living rent campaign paid off.”
But he insisted there was more the Government could do to tackle the cost-of-living crisis.
Mr Sarwar said: “No one will be surprised by the inclusion of a referendum Bill today, but they will be frustrated by the waste of money and resources.”
Scottish Liberal Democrat leader Alex Cole-Hamilton said rail fares had already been hiked by 4 per cent this year, meaning the latest announcement “amounts to a two-month delay on further price hikes”.
He added: “When you look at the investment going on across Europe, that’s embarrassing.
“It is clear that after more than 15 years in power, this is a Government that lacks the humility, the creativity and ambition necessary to solve the problems the people of Scotland currently face.
“This is a meagre programme. Nothing new for health when a staggering one in seven Scots is on a waiting list, nothing on long Covid, nothing significant to boost the economy despite the country’s slide towards recession.”
Green MSP Ariane Burgess said Scotland was facing “the biggest social emergency for decades”.
She said: “The rent freeze and eviction ban that the First Minister announced will provide vital stability and support for tenants across Scotland at a time when many are suffering.
"It is one of the steps we are taking, in partnership with the Scottish Government, to mitigate the damage being done by Downing Street and the energy companies.”
Colin Howden, director of sustainable transport campaigners Transform Scotland, said he was “very pleased that the Government has frozen fares on ScotRail, which otherwise might have risen by 12 per cent”.
However, he called for similar action on bus fares.