Of course the Lord foreknew who would believe on him and be saved according to 1 Peter 1:1-2, but when he was upon the cross, he bore the sins of the entire world upon him (2 Corinthians 5:21, Romans 5:18, 1 Timothy 4:10), so that all who would believe on him were given eternal life - it was a gift freely offered to all men as all of man's sins were accounted unto Jesus. Think about it this way: Christ dying on the cross paid the price in full for the sins of all men who have ever lived, the only problem is that some men choose not to accept that free gift by faith, and so their sins are likewise accounted unto their own soul and not accounted unto the blood of Christ. It's like if I buy a gift for you, than that gift is bought and paid for, and is for you and you alone; but when I try to give it to you, you reject it. It's still your gift that is freely offered, but you chose not to accept it, therefore it is not yours to own and have. Same thing with salvation - it's freely offered to any and all men because their debt is already paid for, the only thing they must do is accept the offer.