You are using 3d layers, while your input would work with 2d layers.
If you add another dimension, the code should work:
x = torch.randn(1, 4, 256, 256, 256)
pool = torch.nn.MaxPool3d((4, 4, 4), return_indices=True)
unpool = torch.nn.MaxUnpool3d((4, 4, 4))
o, i = pool(x)      
y = unpool(o, indices=i, output_size=x.size())