While the brothers ate, they noticed a caravan of Ishmaelites coming by on their way to Egypt. Judah realizes that they can get rid of their brother, while still making a profit from the deal. Then they can avoid the difficulty of having to kill Joseph themselves. After all, he is their half-brother. Whether they thought about the fact that Joseph might still die as a result of his captivity is not mentioned. Perhaps they didn't even really think this through. All they cared about was that Joseph would be gone, with little possibility of ever returning -- and that they would not have to deal with any of his dreams ever again.
Apparently Reuben had been away during these proceedings. Perhaps he had been some distance apart, tending to the flocks for several hours. We already know that he intended to rescue his brother somehow and return him to their father. (v.22) It seems that he approached the cistern without first returning to his brothers, for he is quite distressed to see that Joseph is no longer in the pit, and he does not seem to know that Joseph has been sold to the merchants. Reuben had probably intended to sneak back to the cistern and set Joseph free. However, Joseph is long gone, on his way down to Egypt with the Ishmaelite merchants: