One of the Toledot (corollaries) of the Melacha of Boneh (Building) is making an Ohel (overhanging). One application of this issue is opening a portable crib or playpen. Generally, the crib is unfolded, forming four walls and then the board or mattress is placed on top. Does this constitute a prohibition of making an Ohel on Shabbat? Of course, there is no issue in those types of cribs where the mattress board is attached as an integral part of the walls.
Interestingly, Maran (315:3-4) deals with a similar case of setting up a bed made of four walls. He rules that it is permitted to assemble such a bed with a Shinui (unusual manner): First holding the mattress board in place and then assembling the frame underneath. This leniency is based on the fact that making an Ohel is only prohibited when the intent is to form a shelter over a functional space. In the case of the bed and the crib, the mattress board serves as a base for the person on top of it; there is no use for the space created underneath. Therefore, the Menuhat Ahaba (Vol. 2, p. 194, Halacha 21) and most Poskim are lenient. However, the Ben Ish Hai (Shanah Sheniya, Parashat Shemot, Halacha 6), adopts the ruling of the Taz that it is prohibited to lay a board on any structure with four walls, since the space underneath is potential fit to serve a function, as it is an enclosed "private" space.
SUMMARY
It is permitted to assemble a crib or playpen on Shabbat.