Who put one in Hogwarts and the other in the shop? They were both there since the beginning in H.P.C.S, probably even before then. One, Harry tried to hide inside when he's hidding from the Malfoys.
H.P.C.S Chapter 4 page 50
Harry looked quickly around and spotted a large black cabinet to his left; he shot inside it and pulled the doors closed, leaving a small crack to peer through. Seconds later, a bell clanged, and Malfoy stepped into the shop.
The other was inside Hogwarts as peeves smashes it
Filch was looking triumphant. “That vanishing cabinet was extremely valuable!” he was saying gleefully to Mrs. Norris. “We’ll have Peeves out this time, my sweet —”
H.P.C.S Chapter 8 page 28
Where they both in their respective places for years? Since Voldemort first gained power? Vanishing cabinets were very popular at that time. Was it there in case death eaters stormed the castle? So the staff or students could have a quick get away? But that doesn't make much sense, as that would take a long time to evacuate a large amount of people. Does anyone know when and why they were there in the first place?