They are shaped much like toothpaste squeezed a short distance out of the tube. They form in much the same way. The crust on the molten interior of a flow splits and the lava oozes out, flows a short distance, and then solidifies. The process repeats to create thick stacks of pillows. The bulbous shape of pillows is very different from pahoehoe, aa, or blocky lava flows found on land.
Pillows can form in the ocean, lake, or rivers.
Just add water. This photo shows pillow tubes flowing down side of volcanic cone in summit caldera of Axial Volcano. The photo was taken by Bob Embley with a handheld camera from the research submersible Alvin. White sediment is residue of barite mud used by Ocean Drilling Project when they drilled this site in 1994 on Leg 142. More photos of features and deposits.