Bones move out of mesh when changing from Edit mode to Object mode
You have a bit messed up your armature in Pose mode, so you need to switch back to Pose mode, select all your bones, then alt s, alt r, alt g (reset scale, rotation and location)