Set Post Format if find a string in title or post content

You are using $post_id, but you have passed the post ID as $postID. As a result $a is always empty.

Even if it weren’t empty, there is no PHP function srtpos. It’s strpos and you could have more straightforward logic to execute set_post_format.

Wrapping it up:

function CambiarPostFormat( $postID ) {

    $a = get_the_title( $postID );

    if ( !has_post_format( 'image', $postID ) && strpos($a, 'imagenes') !== false)
      set_post_format( $postID, 'image' );
    }