The former cabinet secretary made the suggestion after a rise of almost 50% in the number of inmates over the age of 65.
This has gone from 88 to 130 over the last five years, with the rise linked to an increase in the number of people convicted for historic crimes such as sex abuse charges.
Mr MacAskill said that meant Scottish Prison Service (SPS) staff are now “struggling to cope” with elderly people who are being kept in prison without the appropriate facilities.
He stressed that “age cannot be a ‘get-out-of-jail’ card” for such offenders and suggested the SPS needs to look at alternative ways of dealing with elderly prisoners.
In a piece for The Herald newspaper, he suggested: “Perhaps buying a care home and adding some modest security measures would be a better option than trying to care within one of our existing institutions.”
Mr MacAskill, who stood down from the Scottish Parliament in May 2016, said he recalled “sad though slightly humorous complaints that they couldn’t be doubled up to share a cell, given rheumatism or arthritis that precluded one from climbing onto the top bunk”.
He added: “Prison service staff do an outstanding job but they are not geriatric or psychiatric nurses. They’re struggling to cope with inmates they aren’t trained to deal with and in facilities that aren’t suitable for them.
“So, there will have to be some new thinking and, fortunately, prisons inspectorate is doing just that. Some offenders may reach an age and frailty where electronic tagging is sufficient and their freedom is deprived, either in their home or a specialised care environment.
“Others who are slightly younger or more physically able will still require custodial facilities. But, whether for bunks or showers, our prisons, no matter how new they are, are inappropriate. Given the limited capacities of many and the lower level of security required for most, it’s time to think anew.”
A spokeswoman for the Scottish Prison Service said: “It is acknowledged the number of people in prison with high care needs, including social care need and palliative care need, is a growing issue in Scotland.
“The SPS commissioned an estate-wide social care needs assessment that is scheduled for publication in 2017.”