When a room owner is deactivated, the user who has been in the room the longest automatically becomes the new room owner.
For example, a room contains 3 users, User A, User B and User C. User A is the room owner with User B joining the room a day after its creation and User C joining a week later. If User A is deactivated, User B will become the new room owner and a message will be posted in the room to notify all users that the room owner has changed.
Note: If the deactivated room owner is reactivated, the user will not be automatically made a room owner or a member of the room. When a user is deactivated, all direct chats that included the deactivated user will no longer be visible
Note: This functionality is by design and there is no setting to amend this
Refer to the Knowledge Article found here for more information on IMs and MIMs.