@chetan sikarwar
Thank you for your post!
When it comes to getting a deleted user's group membership, even when the user is in a soft deleted state, this isn't possible unless the user is restored. When a user is deleted, they're removed from any group that they were a member of until they're restored, then they'll automatically rejoin that Azure AD group.
Additionally, any licenses consumed by the user are made available for other users, and once a user is restored, licenses that were assigned to the user at the time of deletion are also restored even if there are no seats available for those licenses. If you are then consuming more licenses more than you purchased, your organization could be temporarily out of compliance for license usage. For more info.
If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.