^There's the correct answer.Except that your quote is actually John 19:24.
As to the passage itself it is important to note that the KJV does not use quotation marks so while it may appear at first glance that the soldiers are saying that they are fulfilling prophecy, actually they're not.
Peter
The author of John noted in hindsight that the soldiers in his story were fulfilling a prophecy, not that the soldiers in his story knew they were fulfilling a prophecy.