So when you gain ownership of any group in Microsoft 365, you have the capability to add/remove members from the group and also modify other properties of the group.
It is a possibility that the group for which ownership was gained, was used to provide access to resources within Azure. For example, if I want that a certain group of users must be able to start a virtual machine in Azure, I will create a group in Azure AD/Entra ID and add it under Access management of that virtual machine with required role/permissions(permission to start or stop a virtual machine).
So, when someone gains the ownership of a group, they can add members to the group and ultimately acquire the access of all the resources wherever that group is used.