The Greek of the last part of 1 Cor 7:39 is:
ἐλευθέρα ἐστὶν ᾧ θέλει γαμηθῆναι, μόνον ἐν Κυρίῳ = she is free to whom
she wishes to be married only in [the] Lord
The OP's question can now be asked this way: Does the adverb μόνον (only) modify the verb θέλει (wishes), or the verb γαμηθῆναι (marries); or both in an extended way?
Note that because we are discussing an adverb, it cannot modify a noun or pronoun such as "whom" or ᾧ in this case. this eliminates one of the OP's options immediately.
The verb "marries" is the most probable one because it is closer to the adverb "only". Further, semantically, "only" modifying "wishes" would be more problematic and so the best way to read this sentence is to have the adverb modify the closest verb. Thus we might paraphrase the translation as:
she is free to marry anyone she wishes, but such a marriage should be
consistent with Christian teaching and the Lord's will (Dottard's extreme paraphrase)
Note that it is difficult to explain this without expressing both marriage and the Lord's will. I assume that Paul is alluding to the principle that he states in 2 Cor 6:14 -
Do not be yoked together with unbelievers. For what do righteousness
and wickedness have in common? Or what fellowship can light have with
Note the comments of Meyer:
only in the Lord, not apart from Christ as the specifically
determining element of the new union; only in a Christian way, i.e.
only to a Christian, s.c. let her be married
Barnes also observes:
Only in the Lord - That is, only to one who is a Christian; with a
proper sense of her obligations to Christ, and so as to promote his
glory. The apostle supposed that could not be done if she were allowed
to marry a pagan, or one of a different religion. The same sentiment
he advances in 2 Corinthians 6:14, and it was his intention,
undoubtedly, to affirm that it was proper for a widow to marry no one
who was not a Christian.