OP will clear both immigration and Customs at MIA outbound to SJU. However, his bags will be checked to SJU. He will merely need to leave them at post-Customs bag drop and will not need to recheck. Should not add more than 2-3 mins. to the total processing time.