An electric bed is formed of a bedstead having an immovable base and a movable base pivotably connected with the immovable base, a drive mounted to the bedstead for driving the movable base to pivot relative to the immovable base, and an air bag mounted to the first or second surface and provided with a hole and a sounder mounted into the hole. The immovable base has a first surface facing the movable base. The movable base has a second surface facing the immovable base. The movable base is pivotable between a lying position and an uplift position relative to the immovable base. If a foreign object or the users body is jammed between the immovable base and the movable base, the air bag will be squeezed to make the sounder sound for warning.