It's simple. "under the law" refers to the OT scriptures and the agreement that the Hebrews had made in Exodus 19.
Thus being "without law", refers to the Gentiles living in ignorance of that law (OT scripture, and agreement; so even though a Gentile did not have the oracles of God which the Hebrews/Jews possessed and the promise associated with the agreement in Exodus 19, all mankind had transgressed God's Law of Ten Commandments none the lews and stood guilty, both Jew and Gentile).
Rom 2:12 For as many as have sinned without law shall also perish without law: and as many as have sinned in the law shall be judged by the law;
Paul used the law (scriptures, OT) to convince Jews:
Act_18:28 For he mightily convinced the Jews, and that publickly, shewing by the scriptures that Jesus was Christ.
Paul did not use the law (scripture, OT) to convince Gentiles at the first (He used logic and Creation, for what does an unbelieving Genitile know about scripture at the first? Nothing):
Act 17:22 Then Paul stood in the midst of Mars' hill, and said, Ye men of Athens, I perceive that in all things ye are too superstitious.
Act 17:23 For as I passed by, and beheld your devotions, I found an altar with this inscription, TO THE UNKNOWN GOD. Whom therefore ye ignorantly worship, him declare I unto you.
Act 17:24 God that made the world and all things therein, seeing that he is Lord of heaven and earth, dwelleth not in temples made with hands;
Act 17:25 Neither is worshipped with men's hands, as though he needed any thing, seeing he giveth to all life, and breath, and all things;
Act 17:26 And hath made of one blood all nations of men for to dwell on all the face of the earth, and hath determined the times before appointed, and the bounds of their habitation;
Act 17:27 That they should seek the Lord, if haply they might feel after him, and find him, though he be not far from every one of us:
Act 17:28 For in him we live, and move, and have our being; as certain also of your own poets have said, For we are also his offspring.
Act 17:29 Forasmuch then as we are the offspring of God, we ought not to think that the Godhead is like unto gold, or silver, or stone, graven by art and man's device.
Act 17:30 And the times of this ignorance God winked at; but now commandeth all men every where to repent:
Act 17:31 Because he hath appointed a day, in the which he will judge the world in righteousness by that man whom he hath ordained; whereof he hath given assurance unto all men, in that he hath raised him from the dead.
It is only when the Gentiles began to believe (repented and were becoming or were already become followers, like Cornelius; &c) that Paul would refer them to the scriptures:
Act 13:42 And when the Jews were gone out of the synagogue, the Gentiles besought that these words might be preached to them the next sabbath.
Act 13:43 Now when the congregation was broken up, many of the Jews and religious proselytes followed Paul and Barnabas: who, speaking to them, persuaded them to continue in the grace of God.
Act 13:44 And the next sabbath day came almost the whole city together to hear the word of God.
Also, Paul would keep some of the ceremonial things around Jews, so as not to offend the Jews that they might hear what the OT had to say about Jesus:
Act_16:3 Him would Paul have to go forth with him; and took and circumcised him because of the Jews which were in those quarters: for they knew all that his father was a Greek.
Yet, in other places, Paul made a stand showing that circumcision (flesh) was unnecessary:
Gal_2:3 But neither Titus, who was with me, being a Greek, was compelled to be circumcised:
The "law to God" is the Ten Commandments which is necessary to obey in all situations.