I assume you would like to create a Dataset returning both images?
The easiest way would be to create an own Dataset class and use your code snippet to load the data:
class MyDataset(Dataset):
    def __init__(self, image1_paths, image2_paths, transform=None):
        self.image1_paths = image1_paths
        self.image2_paths = image2_paths
        self.transform = transform
        
    def __getitem__(self, index):
        img1 = Image.open(self.image1_paths[index])
        img2 = Image.open(self.image2_paths[index])
        
        if self.transform:
            img1 = self.transform(img1)
            img2 = self.transform(img2)
            
        return img1, img2
    
    def __len__(self):
        return len(self.image1_paths)


dataset = MyDataset(
    image1_paths, image2_paths, transform=transforms.ToTensor())

Note that you might want to use torchvision.transforms.functional, if you want to apply random transformations like RandomCrop on both images in the same way.
Also, have a look at the data loading tutorial 51 for more information.