You may use the following commands to connect to Microsoft Office 365 from Windows PowerShell then export the members of a group to a file of your choice.

Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Get-UnifiedGroup -Identity “<<<INSERT_GROUP_NAME>>>” | Get-UnifiedGroupLinks -LinkType Member | Out-File -Filepath “<<<INSERT_FILE_PATH>>>”
Remove-PSSession $Session