No. Villagers need a bed to spawn an iron golem, but not to work. They also restock their trades just fine even if they don't sleep.