If you can get your data into an sf object(s), then sf::st_nearest_points() will do the job.
Below is an example with toy data:
library(sf)
p1 <- matrix(c(0, 0, 1, 0, 1, 1, 0, 1, 0, 0), ncol = 2, byrow = TRUE)
p2 <- p1 + 3
pts1 <- list(p1)
pts2 <- list(p2)
poly1 <- st_polygon(pts1)
poly2 <- st_polygon(pts2)
near_points <- st_nearest_points(poly1, poly2)
Near points returns an sf LINESTRING object with two points(1,1) and (3,3):
Geometry set for 1 feature
geometry type: LINESTRING
dimension: XY
bbox: xmin: 1 ymin: 1 xmax: 3 ymax: 3
epsg (SRID): NA
proj4string: NA
LINESTRING (1 1, 3 3)
ggplot() + geom_sf(data = poly1, color = 'blue') +
geom_sf(data = poly2, color = 'orange') +
geom_sf(data = near_points, color = 'red')

st_distance() will return the distance between the two closest points.
st_distance(poly1, poly2)
[,1]
[1,] 2.828427