Modal form instead of redirect
In a custom module, you need to alter the contact form and add an #ajax attribute to the submit button:

function YOUR_MODULE_form_contact_site_form_alter(&amp;$form, &amp;$form_state) {
    $form['#prefix'] = '&lt;div id="my_form_wrapper"&gt;';
    $form['#suffix'] = '&lt;/div&gt;';

    $form['actions']['submit']['#ajax'] =&gt; array(
          'callback' =&gt; 'ajax_test_dialog_form_callback_modal',
    );
}


And then provide this method, using OpenModalDialogCommand, in your module too:

    function ajax_test_dialog_form_callback_modal($form, &amp;$form_state) {
      $response = new AjaxResponse();

      if ($form_state-&gt;getErrors()) {
        unset($form['#prefix']);
        unset($form['#suffix']);
        $form['status_messages'] = [
          '#type' =&gt; 'status_messages',
          '#weight' =&gt; -10,
        ];
        $response-&gt;addCommand(new HtmlCommand('#my_form_wrapper', $form));
      }
      else {
        $content = 'Something to show in the modal';
        $title = 'Hi, I'm a Modal';
        $response = new AjaxResponse();
        $response-&gt;addCommand(new OpenModalDialogCommand($title, $content, array('width' =&gt; '700')));
      }
      return $response;
    }



  Here I'm making use of the form element status_messages to display
  validation errors, otherwise we pop up a modal with custom text.


With drupal_get_messages() you could get the system messages and clear the queue.

Don't forget to make the classes available

use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;