The volume of a pyramid that has the same base and height as the prism it is inscribed in is exactly one-third the volume of the prism. This is true for any pyramid that can be inscribed in a prism as long as the base and height are the same1.
Since the volume of the pyramid is 18 cubic inches, then the volume of the prism is 3 times that amount which is 54 cubic inches 2.
Therefore, the answer is D. 54 cubic inches.