An electronic device according to one embodiment may include: a first housing including a first side; a second housing including a second side facing the first side; at least one first magnetic member configured to be rotatably disposed inside the first housing and adjacent to the first side; and at least one second magnetic member configured to be rotatably disposed inside the second housing and adjacent to the second side, wherein the first housing and the second housing are rotatably coupled to each other by a magnetic force between the at least one first magnetic member and the at least one second magnetic member. Various other embodiments are also possible.