Leaving laundry or clothing in the washing machine to soak overnight in the water and soap is perfectly fine.
Sometimes stains and other more dirty clothes or dirty laundry needs soaking in some water and cleaning solution or laundry detergent overnight to get the stains or dirt out of the laundry or clothing.
But if you already washed the clothing then they are usually okay in the washing machine overnight but in the morning you should immediately remove the wet clothes from the washing machine and place them in the dryer to get them dry.
Leaving wet clothes in the washing machine for too long could cause mold growth on the laundry or clothing but soaking the laundry or clothing in the washing machine overnight is okay.
I've left clothes in the washing machine overnight after the wash cycle ended and then just put the clean laundry and clothing into the dryer in the morning while I was getting ready for work.