The first answer here is correct in many ways. Economists do certainly argue that, in the long term, automation is good for an economy. However, this does not mean that automation is good right away. It also is not unquestionably good in the way this first answer seems to imply.
First of all, it is clearly true that automation can and does lead to unemployment and underemployment in the short term. As the first answer notes, many autoworkers (for example) have been replaced by machinery in recent times. This can lead to them becoming unemployed or to them becoming underemployed if they are forced to take jobs that do not fully utilize their skills. This phenomenon of underemployment is quite common as relatively skilled jobs are lost and workers are left to take lower-paying jobs, typically in service industries.
Economic theory expects that these people who are replaced by machines will simply find better jobs. As the first answer says, for example, they should get jobs making the machines that replaced them. However, it is no nearly this simple. First of all, the jobs that are still available tend to be much fewer in number than those that were lost (it takes fewer people to make the “black boxes” than the black boxes replaced). Second, these jobs often need skills that the laid-off workers lack. It is easy to say that a laid-off assembly line worker should learn to be a computer programmer, but this is much harder to do in real life. It is very hard for a person in their 40s or 50s to gain the skills needed for a new career. Even if they do, they are likely to suffer from decreased wages as they work their way up in the new industry.
Therefore, economic theory does say that automation will not lead to unemployment or underemployment. But that is in the long term only and it ignores the very real short-term impacts (and 5 or 10 years is short term for economists but very long for a struggling family) on people’s lives and their careers.