Some free hubs are just held on by friction so they can sometimes just slide off like you describe. Others are held onto the wheel by a bearing dust cap that screws onto the axle. Its inside the hole in the middle of the free hub. If that is your hub that may have come loose.
2 Likes