Yes, it is possible to store certain buildings in your inventory.
For this you would need a special item, the: Store Building Item
This items allows you to store special event buildings from your city back to your inventory. Normal buildings can't be stored, since those can be build anytime (with the needed ressources) from the Build Menu. If you store a military building, then you will lock all unlocked slots again, so make sure you really want to store those buildings.
How does it work?
Open your inventory and select the Store Building Item and click on 'Use':
You will then see a box icon above every building you can put back into your inventory. Click on the building you want to store. You will then see, what you will lose (population / happiness), once the building is stored and need to confirm the process.
If you clicked on the wrong building, then just click on 'Cancel' in the conformation window. If you want to cancel the whole store process, then click on the red cancel-button underneath the forge point bar.
For every single building you want to store, you will need one Store Building Item.
How can I get the Store Building Item?
You can get the Store Building Item from various occasions ingame: