How to connect two bed legs to make a bunk bed from two regular beds?
What I would do is attach a length of pine stock the same width (2 3/4) and thickness (3/4) to the inside of the each corner of the bottom bed, lift the top bed into position, and then install 4 more pieces of pine stock opposite the other four so as to sandwich the legs of the top in between.