Step-by-step explanation:
Bob and Alice could first send each other their open locks. Then, e.g., Alice can send a message to Bob and lock her box with Bob's lock, and vice-versa.
A more real-world approach to this problem is that they use a form of Diffie-Hellman approach to exchange a combination for the lock.
Diffie-Hellman is an algorithm where you can exchange secrets even if you know someone is intercepting each and every message you exchange. It's a bit mathematical, but still very cool.