There are several issues here.
Q1. Can a t-test be used with data that is a percentage?
A - Strictly speaking a t-test should be used when the underlying population has a normal distribution and you have to estimate the mean and variance simultaneously. Your percentage pass rates are not going to normally distributed, but they may well be close enough that no harm is done by using a t-test. This is unlikely to be the big obstacle.
Q2. What is the right way to aggregate the percentage pass rates into an overall pass rate?
A - you should use a weighted average of the percentages, with the weights being the class sizes. This will give you a percentage (for each of your two groups of classes) that is equivalent to their overall individual percentage pass rate. There are several equivalent ways of calculating this; one is by a weighted average, the other is (as you have started doing) converting each class score into a number of passing students and a total number of students, summing these numbers and calculating the final percentage.
There are complications in estimating the variance to use for a t-test but I will ignore these because of Q3 below:
Q3. (implied) - is this procedure as a method of comparing pass rates between two groups appropriate?
A - No. The problem is that there are known to be very significant class (teacher) and school effects in educational performance. No simple t-test can take these into account, and a t-test will give you a big chance of showing something as significant when it isn't. Basically, the data in these grouped situations is not worth as much as its sample size suggests. This is because 30 students in one class are not really 30 independent data points - they may all be reflecting skill of the teacher (even putting aside other important known environmental variables, and their individual socio economic background). The accepted way to do the sort of inference you want is with a multi-level model, a special case of a mixed-effects model, which unfortunately is much harder to implement than a t test, but will give you much more reliable results.