yes, also when something is in bad condition, nearly broken. literally, it means, something is about to die "not able to stand", but it can refer to anything, including machines, that are about to stop working. Be careful if you use it to refer to people, because "x is on his last legs" implies x is about to die.