WordPress loop, show only one post per custom field

I would add an array at the top to store the company’s ID as you loop through all the deals.

Every time you go through the loop you check the array for the current company ID. If it isn’t there then you can safely show that deal. Then add the ID to the array so that next time that company comes around you will be able to skip any other deals for that company.

Here is what your new code might look like. (Replace “the current company ID” with the proper variable to keep track of your companies by ID, I think $term->ID, but I admittedly only read your code enough to get a fair idea of the main function of it)

<?php
$num_cats_to_show = 50;
$count = 0;
/*----NEW STUFF----*/
$company_id_array = array();//NEW VARIABLE

$posts = new WP_Query(array('post_type' => 'companies'));
$terms = $posts->get_posts();
if ($terms) {
  foreach( $terms as $term ) {
    $args2=array(
      'post_type' => 'deals',
      'meta_query' => array(
                        array(
                            'key' => 'company', // name of custom field
                            'value' => '"'. ($term->ID) .'"', // matches exaclty "123", not just 123. This prevents a match for "1234"
                            'compare' => 'LIKE'
                            )
                    ),
      'posts_per_page' => 1,
      );
    $my_query = null;
    $my_query = new WP_Query($args2);
    if( $my_query->have_posts() ) {
      $count ++;
      /*----NEW STUFF----*/
      if ($count <= $num_cats_to_show && !(in_array("the current company ID", $company_id_array))) {
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          /*----NEW STUFF----*/
          $company_id_array[] = "the current company ID";//ADD THE ID TO THE ARRAY (YOU HAVE ALREADY CHECKED THAT IT WASN'T THERE YET)
          <?php echo $term->ID ?><p><a href="https://wordpress.stackexchange.com/questions/235278/<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
         <?php
        endwhile;
      }
    }
  }
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>