Let $AB = 3, AC = 4, BC = 5$ in $\Delta ABC$. Draw the altitude from point $A$ to $BC$, and label their intersection $M$. Also, let the inscribed rectangle be $PQRS$, where $P$ lies on $AB$, $Q$ lies on $AC$, $R$ lies on $MC$ and $S$ lies on $BM$.
Now the altitude $AM$ is $\frac{4 \times 3}{5}$ (can you find the area two different ways?) Then $BM = \frac{9}{5}$ and $CM = \frac{16}{5}$. The height of the rectangle is given by $\frac{PS}{BS} = \frac{AM}{BM} \Rightarrow \frac{h}{BS} = \frac{12/5}{9/5}$, so $h = \frac{4}{3} BS$. Similarly, the height of the rectangle is also given by $\frac{QR}{RC} = \frac{AM}{MC}$, so $\frac{h}{RC} = \frac{12/5}{16/5} \Rightarrow h = \frac{3}{4} RC$. Equating the two, $\frac{4}{3} BS = \frac{3}{4} RC \Rightarrow RC = \frac{16}{9} BS$.
Let $BS = x$. Then the perimeter is given by $2 \left(\frac{4}{3}x + \frac{9}{5} - x + \frac{16}{5} - \frac{16}{9}x \right)$, where there are restrictions on $x$. Can you continue?