An electronic device (100, 200) comprising: a first housing; a second housing coupled to the first housing and configured to slide in a first direction or a second direction opposite the first direction with respect to the first housing between a first position at which at least a portion of the second housing is accommodated in the first housing and a second position at which the second housing protrudes from the first housing; an optical module comprising optical circuitry mounted on the second housing, the optical module configured to rotate in response to sliding of the second housing to be disposed to face a rear side of the first housing at the first position and to face a front side of the first housing at the second position; an elastic member comprising a flexible elastic material accommodated in the second housing and configured to provide an elastic force to the optical module; a first slide mounted in the second housing and slidably coupled to the first housing; a rotation support mounted on the first slide, wherein the optical module includes a case at least partially exposed outward of the second housing and a rotating shaft extending from both ends of the case and rotatably mounted on the rotation support; a second slide mounted on the first slide to slide on the first slide; a rack gear provided on the second slide; a pinion gear provided at an end of the rotating shaft and configured to be engaged with the rack gear to rotate the optical module based on the second slide sliding on the first slide; a guide stopper disposed on the first slide; a second slide mounted on the first slide and coupled to the guide stopper to slide on the first slide; a first guide hole provided in the first slide, and including an inclined section extending to be inclined with respect to the first direction and a linear section extending from one end of the inclined section parallel to the first direction; a second guide hole provided in the second slide and extending in a direction perpendicular to a moving direction of the first slide; and a first guide protrusion provided on the guide stopper and accommodated in the first guide hole through the second guide hole. a first housing; a second housing coupled to the first housing and configured to slide in a first direction or a second direction opposite the first direction with respect to the first housing between a first position at which at least a portion of the second housing is accommodated in the first housing and a second position at which the second housing protrudes from the first housing; an optical module comprising optical circuitry mounted on the second housing, the optical module configured to rotate in response to sliding of the second housing to be disposed to face a rear side of the first housing at the first position and to face a front side of the first housing at the second position; an elastic member comprising a flexible elastic material accommodated in the second housing and configured to provide an elastic force to the optical module; a first slide mounted in the second housing and slidably coupled to the first housing; a rotation support mounted on the first slide, wherein the optical module includes a case at least partially exposed outward of the second housing and a rotating shaft extending from both ends of the case and rotatably mounted on the rotation support; a second slide mounted on the first slide to slide on the first slide; a rack gear provided on the second slide; a pinion gear provided at an end of the rotating shaft and configured to be engaged with the rack gear to rotate the optical module based on the second slide sliding on the first slide; a guide stopper disposed on the first slide; a second slide mounted on the first slide and coupled to the guide stopper to slide on the first slide; a first guide hole provided in the first slide, and including an inclined section extending to be inclined with respect to the first direction and a linear section extending from one end of the inclined section parallel to the first direction; a second guide hole provided in the second slide and extending in a direction perpendicular to a moving direction of the first slide; and a first guide protrusion provided on the guide stopper and accommodated in the first guide hole through the second guide hole.