Answer
The purpose of these membranes is to line the thoracic cavity and the lungs, holding the lungs in place, providing freedom of movement within the cavity, and reducing friction due to the serous fluid between the membranes.
Work Step by Step
Membranes line the walls of the ventral body cavities and the surfaces of the organs within those cavities. These membranes hold the organs in their proper place while also allowing some freedom of movement within the cavity. The space between these membranes contains serous fluid, which reduces friction even as the organs move about (consider the heart pumping, or the lungs filling with air).