Thanks for sharing your question with EmpowHER!
For pregnancy to occur, there must be actual sexual intercourse. You can't get pregnant from the situation you explained, especially with your hand being in open air for so long. Sperm dries up when it is outside the body.
I would not be concerned about pregnancy rom the situation you explained.
I hope this helps ease some fears! For more information about what can and can't cause pregnancy, read on here: https://www.empowher.com/community/share/outercourse-dry-humping-dry-sex...