Con el símbolo de numeral (#) identificas al input y así puedes enviar su valor en el ng-click.
<mat-form-field style="max-width: 21rem; width: 100%;" appearance="outline">
<mat-label>Identificador de comunidad</mat-label>
<input
type="text"
matInput
placeholder="Identificador de comunidad"
autocomplete="off"
#idCommunity
/>
<mat-icon matSuffix>apartment</mat-icon>
</mat-form-field>
<button
class="btn"
style="max-width: 21rem; width: 100%;"
color="primary"
type="button"
mat-raised-button
[disabled]="boolSpinner"
(click)="toValidateCommunity(idCommunity.value)"
>
<mat-icon>shield</mat-icon> ACCEDER COMUNIDAD
</button>