Catalysis of the transfer of nucleic acids from one side of a membrane to the other. Nucleic acids are single or double-stranded polynucleotides involved in the storage, transmission and transfer of genetic information.