A permutability problem in infinite groups and Ramsey's theorem