The reference in view in this question is the crucifixion account in Luke 23.
And when they came to the place that is called The Skull, there they crucified him, and the criminals, one on his right and one on his left. And Jesus said, “Father, forgive them, for they know not what they do.”~ Luke 23:33-34
The short answer to that question is, “no,” Jesus did not forgive them. If you think carefully about this passage, you will see this is the case. Jesus prayed that those who crucified him would be forgiven in the future, he did not thank God that they were already forgiven. If they had already been forgiven, such a prayer would have been superfluous.
Jesus surely could have forgiven them on the spot himself, had they been repentant on the spot. We know from elsewhere in Scripture that Jesus had authority to forgive sins. Indeed, there were times when he told people that their sins were forgiven (Luke 5:20-24, 7:49).
Notice also that on the cross, in exactly the same context where Jesus prayed that his killers would be forgiven, Jesus does grant forgiveness to someone else! There were two criminals hanging with Jesus, and one of them repented. Jesus forgave him immediately: “Today you will be with me in paradise.” He did not say, “I pray that you will be forgiven.” He forgave him. And, Jesus’ forgiveness promised a new relationship: “Today you will be with me in paradise.”
Stephen’s prayer for those who stoned him closely parallels the interceding prayer of Jesus on behalf of his tormentors.
And falling to his knees he [Stephen] cried out with a loud voice, “Lord, do not hold this sin against them.” And when he had said this, he fell asleep.
~ Acts 7:60
I would not be the first to observe that the apostle Paul’s conversion was an answer to Stephen’s prayer. Paul, who stood nearby holding the garments of those who stoned Stephen, was later saved. But, again, it could be pointed out that Stephen did not say to those stoning him, “I forgive you.” Paul was not forgiven until he repented on the road to Damascus. Hypothetically speaking, if Paul had lost his life in a chariot accident during the time period between Stephen’s death and his own conversion, Paul would not have gone to heaven.
Others argue that, elsewhere in Scripture, Jesus does not seem to include repentance as a condition for forgiveness (Matthew 6:12,14-15; 18:21-22). It is true in these verses that Jesus does not explicitly utter a condition of repentance. However, the requirement is implicit. In Matthew 6, Jesus told the disciples to forgive as God forgives. He does not explicitly mention this in Matthew 6, but we learn from other passages that God’s forgiveness is indeed conditional. So the emphasis of Matthew 6 is to forgive as God forgives, which is another reiteration that we ought to forgive only repentant offenders.
In Matthew 18:21-22, Jesus does not explicitly include repentance as a prerequisite for forgiveness. However, the conditional nature of forgiveness is certainly assumed in the context of the chapter. Both in the teaching on church discipline in Matthew 18:15-20, and in the parable that follows in Matthew 18:23-35, Jesus describes situations in which people should be forgiven when they repent.
Forgiveness is conditional. The great Reformed theologian John Murray summarized this truth as follows:
Forgiveness is a definite act performed by us on the fulfillment of certain conditions…. Forgiveness is something actively administered on the repentance of the person who is to be forgiven. We greatly impoverish ourselves and impair the relations that we should sustain to our brethren when we fail to appreciate what is involved in forgiveness.
John MacArthur writes:
It is important to understand that Jesus’ plea for his killers’ forgiveness did not guarantee the immediate and unconditional forgiveness of everyone who participated in the crucifixion. He was interceding on behalf of all who would repent and turn to Him as Lord and Savior. His prayer was that when they finally realized the enormity of what they had done and sought the heavenly Father’s forgiveness for their sin, He would not hold the murder of His beloved Son against them.
Divine forgiveness is never granted to people who remain in unbelief and sin. Those who clung to their hatred of Jesus were by no means automatically absolved from their crime by Jesus’ prayer. But those who repented and sought forgiveness, like the centurion, or the thief on the cross, or the priests, or the people in the crowd—all who later embraced Him would find abundant mercy in answer to Christ’s petition on their behalf.
Christ’s prayer was a token of mercy offered to all who heard. He prayed aloud for their sakes (cf. John 11:42). Their sin was so unfathomably heinous that if witnesses had not actually heard Him pray for His killers’ forgiveness, most might have assumed they had committed an unpardonable offense.
The forgiveness Christ prayed for is freely offered to all (Revelation 22:17). In fact, God is eager to forgive repentant sinners. The prodigal son’s father is a vivid picture of God’s eagerness to forgive. The Lord pleads for every sinner to be reconciled to Him (2 Corinthians 5:20; Ezekiel 18:3–32; Acts 17:30). To those who repent from sin, He promises to lavish freely with forgiveness. If that offer was extended to those who murdered the very Author of life, how much more is it available to us today?
 John Murray, “A Lesson in Forgiveness,” in The Collected Writings of John Murray (Carlisle, PA: The Banner of Truth Trust, 1982), 191.