For a 3-day trip from Bangalore, the most time-efficient and practical strategy is to visit Rameshwaram first and Madurai second.
Starting with Rameshwaram allows you to tackle the longest stretch of driving (approx. 10–11 hours) on the first day when your energy levels are highest. This leaves you with a much shorter and more relaxed 7–8 hour drive from Madurai back to Bangalore on the final day.