I do not think that this is possible. I only know that you are able to archive projects, but this is not available for groups and spaces.
You could modify the permission of a group to remove all members and make the group private. I would suggest to read the permissions/settings first, so that you can restore it afterwards with a script.
For spaces this is not possible because of a gap in the api. If you use security groups to setup our space permissions, this could work.