It wasn't just Marx that said this, Keynes also speculated that increasing automation would eventually emancipate men and women from the neccessity of labour. Both of them were writing when the automation of physical labour was just becoming a reality; lately, we are seeing a second industrial revolution where cognitive labour is being automated and people have begun to speculate where this might lead us. Though neither of Marx or Keynes forecast this possibility, this is not at all surprising, as in their time no cognitive labour whatsoever had been automated - but in essence, it's part of their forecast.
Work or labour is has two distinct aspects, it's physical and cognitive aspects. If both are capable of being automated then the possibility of a world without the need for labour arises. In certain situations this is already taken for granted. For example, we see historically that certain professions have become obsolete and likewise people have forecasted that in the present and the future that certain professions too will become obsolete and this has become unsurprising; few people, though, speculate about the end of all professions - the assumption being that professions will change and adapt - and it is specific modalities of the professions that have become obsolete. After all, we no longer have engineers who know how a radio valve works and can fix it - but we still have engineers.
Hannah Arendt distinguished labour from work; the first is a neccesity due to the fact that we live in a world and must secure food and shelter; she distinguishes this from work, which is the work a man or woman freely takes up as a mode of enquiry, of expression or of politics. And this ties to her third category of human possibility - that of action; men and women are free when they are free to act. Labour negates that possibility, whereas work helps fulfill it.
However the emancipation of humanity is not merely a theoretical question, it is also a practical, pragmatic and political question; as the world stands now, the goods of the world accrue to a man due to the labour he puts in to getting them; this was the view of Locke and foundational in his political philosophy; it's also the view of the middle classes and thus part of the ideology of the West and because of the reach of the West, for much of the world now; it's also entered into myth, I mean the mythos of the American dream; this is then the countervailing pressure that works against the possibility of emancipation; and this is no small thing, such an ideology has tremendous currency and pressure; and not merely ideology, but in its practise, for it has concrete effects in the world and is organically linked to it having grown and matured from a world where labouring was a neccesity.
Theoretically speaking, though; were we to posit a world without the neccessity of labour; the question of how we were to divide up the goods of the city, or of the nation still arises and this is and would be a difficult question; and another counter-vailing pressure.
The other important point to put forward is that neither Marx, nor Arendt and nor Keynes put any kind of time line when this emancipation might occur; given that Marx thought in economic categories, I think it is safe to say that a world without the neccesity of labour lays the foundation of a different kind of economic system; when we consider that hunter-gatherer societies were around for tens of thousands of years, that city states were around for millenia, that feudalism was around for a millenia, it's not likely then from that historical view that our current epoch of capitalism will be short; if we date it from the Industrial revolution in England then we can say it's been going for two or three centuries. But can we put a timeline on it? Well one suggestion is to see that the economic epochs have been gradually getting shorter. The last epoch - feudalism - lasted a thousand years; if we halve that to allow for this progressive shortening then we can posit a (crude) timescale for Capitalism - five hundred years. So we're roughly halfway through that period. Capitalism still has a long route ahead of it, as much as it has behind it; and much will change in that period but nevertheless the trajectory will be the same; Some people in sympathy with the ideas of Marx have banded about the term 'Late Capitalism' as though Capitalism was just about to expire some time soon; but in this analysis, it's in its maturity; and this is what the term 'Globalisation' essentially captures; Capitalism had no competitors at the present time and nor on any horizon; thus at present, there is no real and authentic horizon for change; but nevertheless, change will occur. This is one of the great lessons a study of history can tell us and it was the lesson that Marx, Engels & Keynes were trying to teach from their study of economic history.