It can be obtained with a subdivision surface modifier, starting from a simple shape:
Here we can make it using a mirror modifier on X, Y, Z.
The base shape is as shown below: just the profile repeated/rotated at the extremities and at the corner.
With the mirror and the subdivision surface, we obtain this:
Now, refine the profile adding two loop cuts and grabbing down the border:
Edit following the comments, if you want to do it from an already modeled base shape:
- In edit mode, duplicate an edge loop (note that if the subdivision is already applied on the object, that's changing nothing)
- Separate it
- Convert it to curve
- Give some bevel to the curve
- Set the curve 'U' resolution to 1 (that will keep the same amount of vertices around as the original)
- Convert back to mesh
After that, to do: remove some edges loops in the inner part in both objects, join them, and bridge edge loops between them.