From the Super Mario Wiki, the Mario encyclopedia
The Thwomp Elevator is a Thwomp character that appears in Mario & Luigi: Partners in Time. It is shaped much like the Thwomps in Super Mario 64, except it is gray rather than blue. Its purpose in the game is to help the Mario Bros. and their baby selves travel deeper into Thwomp Volcano, but it gets stuck several times and cannot progress any further until the block below it has its corresponding switch is hit; therefore removing it. Eventually, the Thwomp Elevator reaches the bottom area of the volcano. After the brothers defeat Bowser and Baby Bowser, the Thwomp Elevator is launched upward with the two on top of it. Bowser is knocked off by a Shroob UFO into a Time Hole and leaves his baby self to land on the Shroob Mothership, who is taken by it along with the Mario brothers and the "princess". If the player returns to Thwomp Volcano afterward, the Thwomp Elevator is nowhere to be seen, and the blue and green pipes are required to explore the lower levels of the volcano, although the bottom level cannot be accessed.