The intervals package seems to provide a solution here:
require("intervals")
A <- rbind(A1=c(1,7), A2=c(2,5), A3=c(4, 16))
B <- rbind(B1=c(2,3), B2=c(2,20))
# here you can also define if it is an closed or open interval
Aint <- Intervals(A)
Bint <- Intervals(B)
# that should be what you are looking for
interval_overlap(Aint, Bint)