On the eve of the civil war, the population of the United states was approximately 32 million people ( both black and white), of which 20 million lived in the North. Nearly one million Americans worked in industry and manufacturing rather than agriculture so there was no shortage of people to work in factories.
Many thousands of people moved from rural areas to cities to find jobs. Recently arrived immigrants took jobs in factories just to get started in America. Men, women and children worked in factories often for long hours and very little pay.
Also during the civil war, Northern cities and their industries remained untouched and so manufacture and production of goods went on as usual.