In this case, It was a few seconds means A few seconds passed. The construction employs the dummy or expletive *it*, and can be generalized to indicate the ‘presence’ of any extent of time or space:
- It was several years before he realized that she had told him the exact truth.
- It was nearly a hundred yards to the finish line when he felt a sharp pain in his calf.
You can say the same thing as there were; the it was construction favours understanding the duration or distance as a whole, while the there were construction focuses on its measure.
Is it an idiom? It’s a matter of where you draw the line. As J.R. says, it’s tricky to parse; native speakers know what it means, so they don’t have to parse it, but you do have to parse it, so it might as well be an idiom.