It comes after Scots described the experience as “soul destroying and traumatic” in a national consultation.
The seven-day limit would extend the existing protections for families with children and pregnant women to all Scots and won overwhelming backing in the consultation.
Housing minister Kevin Stewart said temporary accommodation can offer an important “safety net” for anyone who finds themselves homeless and has nowhere else to go.
But he added: “It should be a purely temporary measure.
“These consultation responses support Scottish Government proposals to prevent anyone from living in unsuitable temporary accommodation for longer than seven days.
“From May 2021, this new legislation, a UK first, will ensure people are moved into a more appropriate, permanent home as soon as possible.
“The consultation also demonstrated strong support for a set of legally enforceable standards, which people with experiences of homelessness told us would help improve safety and standards by raising problems or issues temporary accommodation.”
Ministers will continue to work with councils around the country to deliver the government’s £50 million plan to eradicate homelessness in Scotland.
Although most people who took part said they had been put in between one and three placements, some claimed they had been in nine, ten or hundreds of accommodations.
“Some described the impact of repeated moves, including wasted time, feeling judged or stigmatised and negative impacts on mental health,” the consultation stated.
Hostels were the most common placement, according to a separate consultation by an advocacy group cited in the report, followed by B&Bs and flats in equal number.
“Most common were the range of negative descriptors used to describe experiences,” the report adds.
“These included ‘soul-destroying’, ‘terrible’, ‘horrific’, ‘traumatic’, ‘never likely to be forgotten’ and ‘humiliating’.
The negative impact on mental health was also raised, with some complaining of depression and anxiety, while others said their physical health was affected by a lack of access to adequate cooking facilities.
Extending the ban on using this form of accommodation for any longer than a week could help “end the ghettoisation of homeless households”, some of those who answered the consultation said. They said such a move would provide for a “parity of rights among people who are homeless”.
The consultation on improving temporary accommodation standards was carried out between May and August last year.