First focusable element within the modal window will receive focus upon opening. This could be configured to focus any other element by adding an ngbAutofocus attribute on it.

<button type="button" ngbAutofocus class="btn btn-danger"
      (click)="modal.close('Ok click')">Ok</button>