Link images to post

If you’re adding an image to your post via “Add Media,” you can simply set where you would like the image to link by setting it in the “Link to” field.

Add link to image in WordPress

If you’re adding an image to your post with “Featured Image,” you can add this to your template:

<?php if ( has_post_thumbnail()) : ?>
   <a href="https://wordpress.stackexchange.com/questions/91357/<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
   <?php the_post_thumbnail(); ?>
   </a>
 <?php endif; ?>

This can be more complex depending on your specific needs. Visit the WordPress Codex for Function Reference/the post thumbnail